Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions openedx/core/djangoapps/password_policy/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.forms import ValidationError

from openedx.core.djangoapps.password_policy import compliance as password_policy_compliance
from openedx.core.djangolib.markup import HTML


class PasswordPolicyAwareAdminAuthForm(AdminAuthenticationForm):
Expand All @@ -24,9 +25,9 @@ def clean(self):
password_policy_compliance.enforce_compliance_on_login(self.user_cache, cleaned_data['password'])
except password_policy_compliance.NonCompliantPasswordWarning as e:
# Allow login, but warn the user that they will be required to reset their password soon.
messages.warning(self.request, str(e))
messages.warning(self.request, HTML(str(e)))
except password_policy_compliance.NonCompliantPasswordException as e:
# Prevent the login attempt.
raise ValidationError(str(e)) # lint-amnesty, pylint: disable=raise-missing-from
raise ValidationError(HTML(str(e))) # lint-amnesty, pylint: disable=raise-missing-from

return cleaned_data
2 changes: 1 addition & 1 deletion openedx/core/djangoapps/user_authn/views/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _enforce_password_policy_compliance(request, user): # lint-amnesty, pylint:
password_policy_compliance.enforce_compliance_on_login(user, request.POST.get('password'))
except password_policy_compliance.NonCompliantPasswordWarning as e:
# Allow login, but warn the user that they will be required to reset their password soon.
PageLevelMessages.register_warning_message(request, str(e))
PageLevelMessages.register_warning_message(request, HTML(str(e)))
except password_policy_compliance.NonCompliantPasswordException as e:
AUDIT_LOG.info("Password reset initiated for email %s.", user.email)
send_password_reset_email_for_user(user, request)
Expand Down