()
| 12069 | flash("Invalid credentials.") |
| 12070 | return render_template("recover.html", title="Recover") |
| 12071 | |
| 12072 | conn = db_connect() |
| 12073 | conn.execute("UPDATE users SET pw_hash=? WHERE username=?", (generate_password_hash(new_pw), username)) |
| 12074 | conn.commit() |
| 12075 | conn.close() |
| 12076 | flash("Password changed.") |
| 12077 | return redirect(url_for("login")) |
| 12078 | |
| 12079 | @app.route("/profile/pic/upload", methods=["POST"]) |
| 12080 | @login_required |
| 12081 | def profile_pic_upload(): |
| 12082 | """profile_pic_upload. |
| 12083 | |
| 12084 | Route handler or application helper. |
| 12085 | |
| 12086 | This docstring was expanded to make future maintenance easier. |
| 12087 | |
| 12088 | Returns: |
| 12089 | Varies. |
| 12090 | """ |
| 12091 | f = request.files.get("pic") |
| 12092 | if not f or not f.filename: |
| 12093 | flash("No picture selected.") |
| 12094 | return redirect(url_for("profile")) |
| 12095 | try: |
| 12096 | mime = _validate_profile_pic_upload(f) |
| 12097 | except ValueError: |
| 12098 | flash("Only images allowed.") |
| 12099 | return redirect(url_for("profile")) |
| 12100 | try: |
nothing calls this directly
no test coverage detected