class ClassicRegisterForm(SetPasswordForm): """ legacy registration form """ next = NextUrlField() username = UserNameField(widget_attrs={'tabindex': 0}) email = UserEmailField() login_provider = PasswordLoginProviderField()
class ChangeEmailForm(forms.Form): """ change email form """ email = UserEmailField(skip_clean=True) def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, \ initial=None, user=None): super(ChangeEmailForm, self).__init__(data, files, auto_id, prefix, initial) self.user = user def clean_email(self): """ check if email don't exist """ if 'email' in self.cleaned_data: try: user = User.objects.get(email=self.cleaned_data['email']) if self.user and self.user == user: return self.cleaned_data['email'] except User.DoesNotExist: return self.cleaned_data['email'] except User.MultipleObjectsReturned: raise forms.ValidationError(u'There is already more than one \ account registered with that e-mail address. Please try \ another.') raise forms.ValidationError(u'This email is already registered \ in our database. Please choose another.')
def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, \ initial=None, user=None): super(ChangeEmailForm, self).__init__(data, files, auto_id, prefix, initial) email_required = not askbot_settings.BLANK_EMAIL_ALLOWED self.fields['email'] = UserEmailField(skip_clean=True, required=email_required) self.user = user
def __init__(self, *args, **kwargs): self.request = kwargs.pop('request', None) super(RegistrationForm, self).__init__(*args, **kwargs) email_required = not askbot_settings.BLANK_EMAIL_ALLOWED self.fields['email'] = UserEmailField(required=email_required) if askbot_settings.TERMS_CONSENT_REQUIRED: self.fields['terms_accepted'] = ConsentField() if askbot_settings.USE_RECAPTCHA: self.fields['recaptcha'] = AskbotReCaptchaField()
class OpenidRegisterForm(forms.Form): """ openid signin form """ next = NextUrlField() username = UserNameField(widget_attrs={'tabindex': 0}) email = UserEmailField() def __init__(self, *args, **kwargs): super(OpenidRegisterForm, self).__init__(*args, **kwargs) if askbot_settings.TERMS_CONSENT_REQUIRED: self.fields['terms_accepted'] = ConsentField()
class ClassicRegisterForm(SetPasswordForm): """ legacy registration form """ next = NextUrlField() username = UserNameField(widget_attrs={'tabindex': 0}) email = UserEmailField() #fields password1 and password2 are inherited def __init__(self, *args, **kwargs): super(ClassicRegisterForm, self).__init__(*args, **kwargs) if askbot_settings.TERMS_CONSENT_REQUIRED: self.fields['terms_accepted'] = ConsentField()
class OpenidRegisterForm(forms.Form): """ openid signin form """ next = NextUrlField() username = UserNameField(widget_attrs={'tabindex': 0}) email = UserEmailField()
def __init__(self, *args, **kwargs): super(ClassicRegisterForm, self).__init__(*args, **kwargs) email_required = not askbot_settings.BLANK_EMAIL_ALLOWED self.fields['email'] = UserEmailField(required=email_required) if askbot_settings.TERMS_CONSENT_REQUIRED: self.fields['terms_accepted'] = ConsentField()
class OpenidRegisterForm(forms.Form): """ openid signin form """ next = NextUrlField() username = UserNameField() email = UserEmailField()