Commit 48e1d007 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki
Browse files

Preserve local password for shibboleth users

Bug #2535
parent 3e5d60b5
......@@ -318,6 +318,12 @@ class LoginForm(AuthenticationForm):
check = captcha.submit(rcf, rrf, RECAPTCHA_PRIVATE_KEY, self.ip)
if not check.is_valid:
raise forms.ValidationError(_('You have not entered the correct words'))
def clean(self):
super(LoginForm, self).clean()
if self.user_cache.provider != 'local':
raise forms.ValidationError(_('Local login is not the current authentication method for this account.'))
return self.cleaned_data
class ProfileForm(forms.ModelForm):
"""
......
......@@ -258,7 +258,6 @@ def switch_account_to_shibboleth(user, local_user, greeting_template_name='im/we
user.delete()
local_user.provider = 'shibboleth'
local_user.set_unusable_password()
local_user.third_party_identifier = user.third_party_identifier
local_user.save()
send_greeting(local_user, greeting_template_name)
......
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