Commit 166d3829 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Improve unusable password validation error message

parent 7408450e
......@@ -496,7 +496,13 @@ class ExtendedPasswordResetForm(PasswordResetForm):
raise forms.ValidationError(_(astakos_messages.ACCOUNT_INACTIVE))
if not user.has_usable_password():
raise forms.ValidationError(_(astakos_messages.UNUSABLE_PASSWORD))
provider = auth_providers.get_provider('local')
available_providers = user.auth_providers.all()
available_providers = ",".join(p.settings.get_title_display for p in \
message = astakos_messages.UNUSABLE_PASSWORD % \
(provider.get_method_prompt_display, available_providers)
raise forms.ValidationError(message)
if not user.can_change_password():
raise forms.ValidationError(_(astakos_messages.AUTH_PROVIDER_CANNOT_CHANGE_PASSWORD))
......@@ -108,7 +108,7 @@ SIGN_TERMS = 'Please, you need to \'Agree with th
CAPTCHA_VALIDATION_ERR = 'You have not entered the correct words. Please try again.'
SUSPENDED_LOCAL_ACC = 'This account does not have a local password. \
Please try logging in using an external login provider (e.g.: twitter)'
UNUSABLE_PASSWORD = 'You can not use a local password for this account. Only external login providers are enabled.'
UNUSABLE_PASSWORD = '%s is not enabled for your account. You can may access your account by logging in with %s.'
EMAIL_UNKNOWN = 'This email address doesn\'t have an associated user account. \
Please make sure you have registered, before proceeding.'
INVITATION_EMAIL_EXISTS = 'An invitation has already been sent to this email.'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment