diff --git a/app/accounts/forms.py b/app/accounts/forms.py index 7c84f221..2a4a966e 100644 --- a/app/accounts/forms.py +++ b/app/accounts/forms.py @@ -69,14 +69,16 @@ def clean_email(self): The "clean_email" method is overridden to ensure that only active staff members can reset their passwords. This is done to prevent unauthorized users from resetting their passwords and gaining access to the system. and prevent users getting an email to reset their password if they are not active or staff members. """ + User = get_user_model() email = self.cleaned_data["email"] - users = User.objects.filter(email=email) - if not users.exists(): - raise forms.ValidationError("There is a error please contact the administrator.") - for user in users: - if not user.is_active or not user.is_staff: - raise forms.ValidationError("There is a error please contact the administrator.") + try: + user = User.objects.get(email=email) + except User.DoesNotExist: + raise forms.ValidationError("There is an error please contact the administrator.") + + if not user.is_active or not user.is_staff: + raise forms.ValidationError("There is an error please contact the administrator.") return email diff --git a/app/templates/accounts/email/activation_email.html b/app/templates/accounts/email/activation_email.html index afa50e9b..3c567091 100644 --- a/app/templates/accounts/email/activation_email.html +++ b/app/templates/accounts/email/activation_email.html @@ -1,60 +1,17 @@ - - -
- -Hi {{ user.username }},
-Thank you for signing up for our service. Please click the link below to activate your account:
- -If you did not sign up for this account, please ignore this email.
-Thank you,
-The Team
-Hi {{ user.username }},
+Thank you for signing up for our service. Please click the link below to activate your account:
+ +If you did not sign up for this account, please ignore this email.
+Thank you,
+The Team
+{% endblock %} diff --git a/app/templates/app/search.html b/app/templates/app/search.html index fdc491a3..dcf8e4c7 100644 --- a/app/templates/app/search.html +++ b/app/templates/app/search.html @@ -19,11 +19,6 @@{{ result.description | truncatewords:10 }}
@@ -38,7 +33,7 @@- {{ result.rank }} + {{ result.rank }}
Hello {{ user.get_username }},
@@ -63,6 +16,4 @@If you didn't request this, please ignore this email.
Thanks,
Your website team
-