예제 #1
0
파일: forms.py 프로젝트: brousch/votealign
class ClassicRegisterForm(SetPasswordForm):
    """ legacy registration form """

    next = NextUrlField()
    username = UserNameField(widget_attrs={'tabindex': 0})
    email = UserEmailField()
    login_provider = PasswordLoginProviderField()
예제 #2
0
파일: forms.py 프로젝트: brousch/votealign
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.')
예제 #3
0
 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
예제 #4
0
 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()
예제 #5
0
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()
예제 #6
0
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()
예제 #7
0
파일: forms.py 프로젝트: brousch/votealign
class OpenidRegisterForm(forms.Form):
    """ openid signin form """
    next = NextUrlField()
    username = UserNameField(widget_attrs={'tabindex': 0})
    email = UserEmailField()
예제 #8
0
파일: forms.py 프로젝트: zouyxdut/boism_org
 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()
예제 #9
0
class OpenidRegisterForm(forms.Form):
    """ openid signin form """
    next = NextUrlField()
    username = UserNameField()
    email = UserEmailField()