()
| 12042 | return render_template("recover.html", title="Recover") |
| 12043 | conn = db_connect() |
| 12044 | row = conn.execute("SELECT q1,q2,q3,enabled FROM user_security WHERE username=?", (username,)).fetchone() |
| 12045 | conn.close() |
| 12046 | if not row or not (row["q1"] and row["q2"] and row["q3"]): |
| 12047 | flash("Recovery is not set up for this user.") |
| 12048 | return render_template("recover.html", title="Recover") |
| 12049 | qs = [(1, row["q1"]), (2, row["q2"]), (3, row["q3"])] |
| 12050 | return render_template("recover.html", title="Recover", username=username, qs=qs, ask=True) |
| 12051 | |
| 12052 | # step == 'reset' |
| 12053 | new_pw = request.form.get("new_password") or "" |
| 12054 | new_pw2 = request.form.get("new_password2") or "" |
| 12055 | if not username or not new_pw or new_pw != new_pw2: |
| 12056 | flash("Passwords do not match.") |
| 12057 | return render_template("recover.html", title="Recover") |
| 12058 | pw_err = _password_strength_error(new_pw, username) |
| 12059 | if pw_err: |
| 12060 | flash(pw_err) |
| 12061 | return render_template("recover.html", title="Recover") |
| 12062 | |
| 12063 | answers = { |
| 12064 | "a1": request.form.get("a1") or "", |
| 12065 | "a2": request.form.get("a2") or "", |
| 12066 | "a3": request.form.get("a3") or "", |
| 12067 | } |
nothing calls this directly
no test coverage detected