From 48750ee66843af9215c91eda81940e194a893c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Mon, 16 Nov 2020 15:45:25 +0200 Subject: [PATCH] Update "Change Password" to show messages in panel's footer --- hc/accounts/views.py | 6 +++++- templates/accounts/profile.html | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hc/accounts/views.py b/hc/accounts/views.py index 2cedd00e..8c8e5eec 100644 --- a/hc/accounts/views.py +++ b/hc/accounts/views.py @@ -231,6 +231,10 @@ def profile(request): if ctx["removed_credential_name"]: ctx["2fa_status"] = "info" + if request.session.pop("changed_password", False): + ctx["changed_password"] = True + ctx["email_password_status"] = "success" + if request.method == "POST" and "leave_project" in request.POST: code = request.POST["code"] try: @@ -471,7 +475,7 @@ def set_password(request): # the user doesn't get logged out update_session_auth_hash(request, request.user) - messages.success(request, "Your password has been set!") + request.session["changed_password"] = True return redirect("hc-profile") return render(request, "accounts/set_password.html", {}) diff --git a/templates/accounts/profile.html b/templates/accounts/profile.html index 756f2fe1..d1b43ef4 100644 --- a/templates/accounts/profile.html +++ b/templates/accounts/profile.html @@ -33,7 +33,7 @@
-
+