delete. Route handler or application helper. This docstring was expanded to make future maintenance easier. Returns: Varies.
()
| 11884 | def settings_security_questions(): |
| 11885 | """settings_security_questions. |
| 11886 | |
| 11887 | Internal helper function. |
| 11888 | |
| 11889 | This docstring was added automatically to improve maintainability. |
| 11890 | |
| 11891 | Returns: |
| 11892 | Varies. |
| 11893 | """ |
| 11894 | me = current_user() |
| 11895 | q1 = request.form.get("q1") or "" |
| 11896 | q2 = request.form.get("q2") or "" |
| 11897 | q3 = request.form.get("q3") or "" |
| 11898 | a1 = request.form.get("a1") or "" |
| 11899 | a2 = request.form.get("a2") or "" |
| 11900 | a3 = request.form.get("a3") or "" |
| 11901 | enabled = (request.form.get("enable_2fa") == "1") |
| 11902 | |
| 11903 | # Require all questions, and require answers when enabling for the first time. |
| 11904 | existing = get_user_security(me) |
| 11905 | need_answers = enabled and (not existing.get("q1") or not existing.get("q2") or not existing.get("q3")) |
| 11906 | if enabled and (not q1 or not q2 or not q3): |
| 11907 | flash("All fields required.") |
| 11908 | return redirect(url_for("settings_security")) |
| 11909 | if need_answers and (not a1 or not a2 or not a3): |
| 11910 | flash("All fields required.") |
| 11911 | return redirect(url_for("settings_security")) |
| 11912 | |
| 11913 | set_user_security(me, q1, q2, q3, a1, a2, a3, enabled) |
| 11914 | flash("Saved.") |
| 11915 | return redirect(url_for("settings_security")) |
| 11916 | |
| 11917 | @app.route("/two_factor", methods=["GET", "POST"]) |
| 11918 | def two_factor(): |
| 11919 | """two_factor. |
| 11920 |
nothing calls this directly
no test coverage detected