From 649591ca6f8e518696e002872cfa5f5847101e7c Mon Sep 17 00:00:00 2001 From: uxairibrar Date: Mon, 21 Jul 2025 18:12:12 +0200 Subject: [PATCH 1/2] Updated error messages --- publications/views.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/publications/views.py b/publications/views.py index b7c00d90..5d73fcd2 100644 --- a/publications/views.py +++ b/publications/views.py @@ -374,14 +374,25 @@ def change_useremail(request): 'text': 'You attempted to change your email to an address that is blocked. Please contact support for assistance.' } }) - messages.error(request, "Invalid email change request.") - return render(request, 'changeuser.html') if not email_new or email_new == email_old: messages.error(request, "Invalid email change request.") - return render(request, 'changeuser.html') + return render(request, "error.html", { + 'error': { + 'class': 'danger', + 'title': 'Invalid Email Change!', + 'text': 'You attempted to change your email to an address that is invalid. Please enter a valid email address.' + } + }) if User.objects.filter(email=email_new).exists(): messages.error(request, "This email is already in use.") - return render(request, 'changeuser.html') + return render(request, "error.html", { + 'error': { + 'class': 'danger', + 'title': 'Email Already In Use!', + 'text': 'You attempted to change your email to an address that is already in use.' + } + }) + token = secrets.token_urlsafe(32) cache.set( f"{EMAIL_CONFIRMATION_TOKEN_PREFIX}_{email_new}", From 384306d40f0beffabb6c3119ce4690a92cc021b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20N=C3=BCst?= Date: Tue, 22 Jul 2025 14:01:17 +0200 Subject: [PATCH 2/2] Clarify error message --- publications/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/publications/views.py b/publications/views.py index 5d73fcd2..1196de8a 100644 --- a/publications/views.py +++ b/publications/views.py @@ -380,7 +380,7 @@ def change_useremail(request): 'error': { 'class': 'danger', 'title': 'Invalid Email Change!', - 'text': 'You attempted to change your email to an address that is invalid. Please enter a valid email address.' + 'text': 'You attempted to change your email to an address that is invalid. Please enter a valid email address that is different from the current one.' } }) if User.objects.filter(email=email_new).exists():