def __init__(self, *args, **kwargs): email_required = kwargs.pop('email_required', app_settings.EMAIL_REQUIRED) self.username_required = kwargs.pop('username_required', app_settings.USERNAME_REQUIRED) super(BaseSignupForm, self).__init__(*args, **kwargs) # field order may contain additional fields from our base class, # so take proper care when reordering... field_order = ['email', 'username'] merged_field_order = list(self.fields.keys()) if email_required: self.fields["email"].label = ugettext("E-mail") self.fields["email"].required = True else: self.fields["email"].label = ugettext("E-mail (optional)") self.fields["email"].required = False if self.username_required: field_order = ['username', 'email'] # Merge our email and username fields in if they are not # currently in the order. This is to allow others to # re-arrange email and username if they desire. Go in reverse # so that we make sure the inserted items are always # prepended. for field in reversed(field_order): if not field in merged_field_order: merged_field_order.insert(0, field) set_form_field_order(self, merged_field_order) if not self.username_required: del self.fields["username"]
def __init__(self, *args, **kwargs): email_required = kwargs.pop( 'email_required', app_settings.EMAIL_REQUIRED ) self.username_required = kwargs.pop( 'username_required', app_settings.USERNAME_REQUIRED ) super(BaseSignupForm, self).__init__(*args, **kwargs) # field order may contain additional fields from our base class, # so take proper care when reordering... field_order = ['email', 'username'] merged_field_order = list(self.fields.keys()) if email_required: self.fields["email"].label = ugettext("E-mail") self.fields["email"].required = True else: self.fields["email"].label = ugettext("E-mail (optional)") self.fields["email"].required = False if self.username_required: field_order = ['username', 'email'] # Merge our email and username fields in if they are not # currently in the order. This is to allow others to # re-arrange email and username if they desire. Go in reverse # so that we make sure the inserted items are always # prepended. for field in reversed(field_order): if not field in merged_field_order: merged_field_order.insert(0, field) set_form_field_order(self, merged_field_order) if not self.username_required: del self.fields["username"]
def __init__(self, *args, **kwargs): kwargs['email_required'] = InvenTreeSetting.get_setting( 'LOGIN_MAIL_REQUIRED') super().__init__(*args, **kwargs) # check for two mail fields if InvenTreeSetting.get_setting('LOGIN_SIGNUP_MAIL_TWICE'): self.fields["email2"] = forms.EmailField( label=_("Email (again)"), widget=forms.TextInput( attrs={ "type": "email", "placeholder": _("Email address confirmation"), }), ) # check for two password fields if not InvenTreeSetting.get_setting('LOGIN_SIGNUP_PWD_TWICE'): self.fields.pop("password2") # reorder fields set_form_field_order(self, [ "username", "email", "email2", "password1", "password2", ])
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) login_widget = forms.TextInput(attrs={ 'placeholder': 'Seu RA, etc', 'autofocus': 'autofocus' }) login_field = forms.CharField(label="ID universitário", widget=login_widget) self.fields["login"] = login_field set_form_field_order(self, ['university'])
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['email'].label = "Email acadêmico" self.fields['email2'].label = "Email acadêmico (novamente)" self.fields['email2'].widget = forms.TextInput( attrs={ 'type': 'email', 'placeholder': '*****@*****.**', 'data-validation': 'required email confirmation', 'data-validation-confirm': 'email' }) set_form_field_order(self, ['university'])
def __init__(self, *args, **kwargs): super(AccountSignUpForm, self).__init__(*args, **kwargs) self.fields['password1'] = AddonPasswordField(label='Password') if app_settings.SIGNUP_PASSWORD_ENTER_TWICE: self.fields['password2'] = AddonPasswordField( label='Password (again)') self.field_order = [ 'username', 'email', 'password1', 'password2', 'captcha' ] else: self.field_order = ['username', 'email', 'password1', 'captcha'] if hasattr(self, 'field_order'): set_form_field_order(self, self.field_order) if not settings.DEBUG: self.fields["captcha"] = ReCaptchaField(label="")
def __init__(self, *args, **kwargs): self.request = kwargs.pop('request', None) super(AccountLoginForm, self).__init__(*args, **kwargs) if app_settings.AUTHENTICATION_METHOD == app_settings.AuthenticationMethod.EMAIL: login_widget = UserTextInput('email', attrs={ 'type': 'email', 'placeholder': 'E-mail address', 'autofocus': 'autofocus' }) login_field = EmailField(label='E-mail', widget=login_widget) elif app_settings.AUTHENTICATION_METHOD == app_settings.AuthenticationMethod.USERNAME: login_widget = UserTextInput('username', attrs={ 'placeholder': 'Username', 'autofocus': 'autofocus' }) login_field = CharField(label='Username', widget=login_widget, max_length=get_username_max_length()) else: assert app_settings.AUTHENTICATION_METHOD == app_settings.AuthenticationMethod.USERNAME_EMAIL login_widget = UserTextInput('username_email', attrs={ 'placeholder': 'Username or e-mail', 'autofocus': 'autofocus' }) login_field = CharField(label='Login', widget=login_widget) self.fields["login"] = login_field if not settings.DEBUG: self.fields["captcha"] = ReCaptchaField(label="") set_form_field_order(self, ["login", "password", "remember"]) if app_settings.SESSION_REMEMBER is not None: del self.fields['remember']
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.fields['email'].label = "Email acadêmico" set_form_field_order(self, ['university'])