From f5ec27f6fd5a2262e3429a874857f0f4517e38a1 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 26 Aug 2020 23:36:08 +0200 Subject: fixed self deletion of account. --- newspipe/templates/profile.html | 2 +- newspipe/web/views/session_mgmt.py | 6 +++++- newspipe/web/views/user.py | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/newspipe/templates/profile.html b/newspipe/templates/profile.html index edbae368..12517331 100644 --- a/newspipe/templates/profile.html +++ b/newspipe/templates/profile.html @@ -61,7 +61,7 @@
diff --git a/newspipe/web/views/session_mgmt.py b/newspipe/web/views/session_mgmt.py index 4fab943f..5e0ac64d 100644 --- a/newspipe/web/views/session_mgmt.py +++ b/newspipe/web/views/session_mgmt.py @@ -1,6 +1,7 @@ import logging from datetime import datetime +from werkzeug.exceptions import NotFound from flask import ( current_app, flash, @@ -56,7 +57,10 @@ def on_identity_loaded(sender, identity): @login_manager.user_loader def load_user(user_id): - return UserController(user_id, ignore_context=True).get(id=user_id, is_active=True) + try: + return UserController(user_id, ignore_context=True).get(id=user_id, is_active=True) + except NotFound: + pass @current_app.before_request diff --git a/newspipe/web/views/user.py b/newspipe/web/views/user.py index f4f26b71..23a662ac 100644 --- a/newspipe/web/views/user.py +++ b/newspipe/web/views/user.py @@ -201,7 +201,7 @@ def delete_account(): """ UserController(current_user.id).delete(current_user.id) flash(gettext("Your account has been deleted."), "success") - return redirect(url_for("login")) + return redirect(url_for("logout")) @user_bp.route("/confirm_account/", methods=["GET"]) -- cgit