Add copy of Discourse-Auth app,

Probably should split into separate repo at some point, but committing here so I don't lose it
This commit is contained in:
David Taylor
2017-04-11 00:28:35 +01:00
parent 337dbd74fd
commit 6b7889d80e
16 changed files with 473 additions and 1 deletions

View File

@@ -28,6 +28,22 @@ class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
return self.cleaned_data['initials']
class SocialRegisterForm(ProfileRegistrationFormUniqueEmail):
def __init__(self, *args, **kwargs):
super(SocialRegisterForm, self).__init__(*args, **kwargs)
self.fields.pop('password1')
self.fields.pop('password2')
self.fields['email'].widget.attrs['readonly'] = True
def clean_email(self):
initial = getattr(self, 'initial', None)
if(initial['email'] != self.cleaned_data['email']):
raise ValidationError("You cannot change the email")
return initial['email']
# Login form
class PasswordReset(PasswordResetForm):
captcha = ReCaptchaField(label='Captcha')