Commit b5b9ca87 authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

astakos: Handle third party unverified user change password form submition

parent 91392318
......@@ -410,6 +410,11 @@ class ExtendedPasswordResetForm(PasswordResetForm):
try:
user = AstakosUser.objects.get_by_identifier(email)
self.users_cache = [user]
if not user.has_auth_provider('local', auth_backend='astakos'):
provider = auth_providers.get_provider('local', user)
msg = mark_safe(provider.get_unusable_password_msg)
raise forms.ValidationError(msg)
if not user.is_active:
msg = mark_safe(user.get_inactive_message('local'))
raise forms.ValidationError(msg)
......
......@@ -743,7 +743,10 @@ class AstakosUser(User):
'token': token_generator.make_token(self)})
def get_inactive_message(self, provider_module, identifier=None):
provider = self.get_auth_provider(provider_module, identifier)
try:
provider = self.get_auth_provider(provider_module, identifier)
except AstakosUserAuthProvider.DoesNotExist:
provider = auth.get_provider(provider_module, self)
msg_extra = ''
message = ''
......
......@@ -193,6 +193,10 @@ class ShibbolethTests(TestCase):
r = client.post(signup_url, post_data)
self.assertEqual(r.status_code, 404)
r = client.post(reverse('astakos.im.views.target.local.password_reset'),
{'email': 'kpap@synnefo.org'})
self.assertContains(r, 'Classic login is not enabled for your account')
# admin activates the user
u = AstakosUser.objects.get(username="kpap@synnefo.org")
backend = activation_backends.get_backend()
......
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