diff options
-rw-r--r-- | newspipe/templates/profile.html | 2 | ||||
-rw-r--r-- | newspipe/web/views/session_mgmt.py | 6 | ||||
-rw-r--r-- | 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 @@ <br /> <div class="row"> <div class="col"> - <a href="/delete_account" class="btn btn-warning" onclick="return confirm('{{ _('You are going to delete your account.') }}');">{{ _('Delete your account') }}</a> + <a href="{{ url_for('user.delete_account') }}" class="btn btn-warning" onclick="return confirm('{{ _('You are going to delete your account.') }}');">{{ _('Delete your account') }}</a> </div> </div> </div><!-- /.container --> 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/<string:token>", methods=["GET"]) |