示例#1
0
class AuthForm(forms.Form):
    prev_page = CharField(widget=forms.HiddenInput(), required=False)
    password = forms.CharField(
        label='Пароль',
        strip=False,
        required=True,
        widget=forms.PasswordInput,
    )
    username = UsernameField(
        max_length=254,
        widget=forms.TextInput(attrs={'autofocus': True}),
    )
示例#2
0
class LogInForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(attrs={
        'autofocus': True,
        'class': "form-control"
    }))
    password = forms.CharField(
        label=_("Password"),
        strip=False,
        widget=forms.PasswordInput(attrs={
            'autocomplete': 'currenr-password',
            'class': "form-control"
        }))
示例#3
0
class UserLogin(AuthenticationForm):
    username = UsernameField(label=_('Username or Email'),
                             widget=forms.TextInput(attrs={'autofocus': True}))
    password = forms.CharField(
        label=_("Password"),
        strip=False,
        widget=forms.PasswordInput(attrs={'autocomplete': 'current-password'}),
    )

    class Meta:
        model = User
        fields = ['username', 'password']
class LoginForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(
        attrs={
            'class': 'woocommerce-Input woocommerce-Input--text input-text',
            'autofocus': True,
            'placeholder': ' '
        }))
    password = forms.CharField(widget=forms.PasswordInput(
        attrs={
            'class': 'woocommerce-Input woocommerce-Input--text input-text',
            'placeholder': ' '
        }))
示例#5
0
class UserLoginForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(
        attrs={'autofocus': True,
               'class': 'form-control form-control-lg', 'placeholder': 'Логин'}))
    password = forms.CharField(
        label="Password",
        strip=False,
        widget=forms.PasswordInput(
            attrs={'autocomplete': 'current-password',
                   'class': 'form-control form-control-lg',
                   'placeholder': 'Пароль'}),
    )
示例#6
0
class LoginForm(forms.Form):
    username = UsernameField(widget=forms.TextInput(attrs={
        'autofocus': True,
        'class': 'form-control'
    }))
    password = forms.CharField(
        label=_("Password"),
        strip=False,
        widget=forms.PasswordInput(attrs={
            'autocomplete': 'current-password',
            'class': 'form-control'
        }))
示例#7
0
class LoginForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(attrs={
        'autofocus': True,
        'class': 'form-control'
    }))
    password = forms.CharField(
        label='Password',
        widget=forms.PasswordInput(attrs={
            'autofocus': True,
            'strip': False,
            'class': 'form-control'
        }))
示例#8
0
class LoginForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(
        attrs={
            'class': 'input',
            'autofocus': True,
            'placeholder': 'username'
        }))
    password = forms.CharField(widget=forms.PasswordInput(
        attrs={
            'class': 'input',
            'placeholder': 'password'
        }))
示例#9
0
class LoginForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(attrs={
        'autofocus': True,
        'class': 'form-control'
    }), )
    password = forms.CharField(
        strip=False,
        widget=forms.PasswordInput(attrs={
            'autocomplete': 'current-password',
            'class': 'form-control'
        }),
    )
示例#10
0
文件: forms.py 项目: radithadi/EPC
class AuthenticationForm(BaseAuthenticationForm):   
    username = UsernameField(widget=forms.TextInput(attrs={
        'autofocus': True,
        'class': 'form-control',
        'placeholder': _('Enter username'),
    }))
    password = forms.CharField(label=_("Password"), strip=False,
                               widget=forms.PasswordInput(attrs={
                                   'autocomplete': 'current-password',
                                   'class': 'form-control',
                                   'placeholder': _('Password')
                               }))
示例#11
0
class LoginForm(AuthenticationForm):
    username = UsernameField(
        max_length=254,
        widget=forms.TextInput(attrs={
            'autofocus': True,
            'class': 'input100'
        }),
    )
    password = forms.CharField(
        label=_("Password"),
        strip=False,
        widget=forms.PasswordInput(attrs={'class': 'input100'}))
示例#12
0
class RegistrationForm(UserCreationForm):
    username = UsernameField(max_length=254,
                             widget=forms.TextInput(
                                 attrs={
                                     'class': 'form-control',
                                     'placeholder': 'username',
                                     'autofocus': True,
                                 }))
    first_name = forms.CharField(max_length=30,
                                 required=False,
                                 help_text='Optional.',
                                 widget=forms.TextInput(
                                     attrs={
                                         'class': 'form-control',
                                         'name': 'first_name',
                                         'placeholder': 'first name',
                                     }))
    last_name = forms.CharField(max_length=30,
                                required=False,
                                help_text='Optional.',
                                widget=forms.TextInput(
                                    attrs={
                                        'class': 'form-control',
                                        'name': 'last_name',
                                        'placeholder': 'last name',
                                    }))
    email = forms.EmailField(
        max_length=254,
        help_text='Required. Inform a valid email address.',
        widget=forms.TextInput(attrs={
            'class': 'form-control',
            'name': 'email',
            'placeholder': 'email',
        }))
    password1 = forms.CharField(widget=forms.PasswordInput(
        attrs={
            'class': 'form-control',
            'placeholder': 'password',
        }))
    password2 = forms.CharField(widget=forms.PasswordInput(
        attrs={
            'class': 'form-control',
            'placeholder': 'confirm password',
        }))
    link_yahoo = forms.BooleanField(widget=forms.CheckboxInput(attrs={
        'name': 'link_yahoo',
        'checked': True
    }))

    class Meta:
        model = User
        fields = ('username', 'email', 'first_name', 'last_name', 'password1',
                  'password2', 'link_yahoo')
示例#13
0
class CustomAuthenticationForm(AuthenticationForm):
    username = UsernameField(widget=TextInput(attrs={
        'autofocus': True,
        "class": "form-control"
    }))
    password = CharField(
        label="Password",
        strip=False,
        widget=PasswordInput(attrs={
            'autocomplete': 'current-password',
            'class': 'form-control'
        }))
示例#14
0
class CustomUserForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(attrs={
        'class': 'input_user',
        'placeholder': 'Username'
    }))

    password = forms.CharField(widget=forms.PasswordInput(
        attrs={
            'class': 'input_user',
            'placeholder': 'Password',
            'autocomplete': 'password'
        }))
示例#15
0
class StudentSignUpForm(UserCreationForm):
    username = UsernameField(
        label='მომხმარებლის სახელი',
        widget=forms.TextInput(attrs={'autofocus': True}),
        error_messages={
            'required': "ეს ველი სავალდებულოა",
        }
    )
    password1 = forms.CharField(
        label="პაროლი",
        strip=False,
        widget=forms.PasswordInput(attrs={'autocomplete': 'current-password'}),
        error_messages={
            'required': "ეს ველი სავალდებულოა",
        }
    )
    password2 = forms.CharField(
        label="გაიმეორეთ პაროლი",
        strip=False,
        widget=forms.PasswordInput(attrs={'autocomplete': 'current-password'}),
        error_messages={
            'required': "ეს ველი სავალდებულოა",
        }
    )

    error_messages = {
        'password_mismatch': 'პაროლები არაა იდენტური.',
    }

    interests = forms.ModelMultipleChoiceField(
        label='ინტერესი',
        queryset=Subject.objects.all(),
        widget=forms.CheckboxSelectMultiple,
        required=True
    )

    class Meta(UserCreationForm.Meta):
        model = User

    def __init__(self, *args, **kwargs):
        super(StudentSignUpForm, self).__init__(*args, **kwargs)
        for field in self.fields.values():
            field.error_messages = {'required': ' ველის შევსება აუცილებელია'.format(
                fieldname=field.label)}

    @transaction.atomic
    def save(self):
        user = super().save(commit=False)
        user.is_student = True
        user.save()
        student = Student.objects.create(user=user)
        student.interests.add(*self.cleaned_data.get('interests'))
        return user
示例#16
0
class UserProfileForm(UserChangeForm):
    password = None
    username = UsernameField(
        widget=forms.TextInput(attrs={
            'class': 'form-control',
            'placeholder': 'Логин',
            'readonly': True
        }),
        label=Icon('user', 'far').as_html())
    ReCaptcha = ReCaptchaField(
        ReCaptchaWidget(),
        label='',
        error_messages={'required': 'Каптча не пройдена!'})

    class Meta:
        model = RExamUserModel
        fields = ('username', 'email', 'last_name', 'first_name',
                  'middle_name', 'study_group', 'ReCaptcha')
        widgets = {
            'first_name':
            TextInput(attrs={
                'class': 'form-control',
                'placeholder': 'Имя'
            }),
            'last_name':
            TextInput(attrs={
                'class': 'form-control',
                'placeholder': 'Фамилия'
            }),
            'middle_name':
            TextInput(attrs={
                'class': 'form-control',
                'placeholder': 'Отчество',
            }),
            'study_group':
            Select(attrs={
                'class': 'form-control',
                'placeholder': 'Группа'
            }),
            'email':
            EmailInput(attrs={
                'class': 'form-control',
                'placeholder': 'E-Mail'
            }),
        }
        labels = {
            'first_name': Icon('address-card', 'far').as_html(),
            'last_name': Icon('address-card', 'far').as_html(),
            'middle_name': Icon('address-card', 'far').as_html(),
            'study_group': Icon('users', 'fas').as_html(),
            'email': Icon('envelope', 'far').as_html(),
        }
示例#17
0
class SchedulerUserForm(forms.ModelForm):
    error_messages = {
        'login_required': _('Specify username'),
        'password_required': _('Specify password'),
        'password_mismatch': _("Passwords don't match."),
    }
    login = UsernameField(label=_('Username'), max_length=128, required=False)
    password1 = forms.CharField(label=_("Password"),
                                widget=forms.PasswordInput,
                                required=False)
    password2 = forms.CharField(label=_("Confirmation"),
                                required=False,
                                widget=forms.PasswordInput)

    def clean_password1(self):
        password1 = self.cleaned_data.get('password1')
        if not getattr(self.instance, 'pk', None) and self.cleaned_data.get(
                'login') and not password1:
            raise forms.ValidationError(
                self.error_messages['password_required'],
                code='password_required')
        return password1

    def clean_password2(self):
        password1 = self.cleaned_data.get('password1') or ''
        password2 = self.cleaned_data.get('password2') or ''
        if password1 != password2:
            raise forms.ValidationError(
                self.error_messages['password_mismatch'],
                code='password_mismatch')
        elif password2:
            # Validate if passwords similar and both specified
            password_validation.validate_password(password2, self.instance)
        return password2

    def clean(self):
        if not self.cleaned_data.get('login') and self.cleaned_data.get(
                'password2'):
            self.add_error('login', self.error_messages['login_required'])
        return super().clean()

    def save(self, commit=True):
        if self.cleaned_data['login']:
            self.instance.password = self.cleaned_data['password2']
            return super(SchedulerUserForm, self).save(commit)
        elif getattr(self.instance, 'pk', None):
            self.instance.delete()
        return None

    class Meta:
        model = SchedulerUser
        fields = ('login', 'password1', 'password2')
示例#18
0
class CxUserAuthenticationForm(AuthenticationForm):
    """Customize user login form & add hint
    messages for client side validation."""
    validation_hints = HINTS['user']

    username = UsernameField(widget=forms.TextInput(attrs=USERNAME_STYLE))
    password = forms.CharField(
        label=LABELS['user']['password'],
        strip=False,
        widget=forms.PasswordInput(attrs=PASSWORD_STYLE),
    )

    error_messages = ERROR_MSG['user']['username']
示例#19
0
class DuskenAuthenticationForm(AuthenticationForm):
    username = UsernameField(
        max_length=254,
        widget=forms.TextInput(
            attrs={
                'autofocus': True,
                'placeholder': _('Email address / username'),
                'autocomplete': 'off',
                'autocorrect': 'off',
                'autocapitalize': 'off',
                'spellcheck': 'false'
            }),
    )
示例#20
0
class CustomAuthenticationForm(AuthenticationForm):

    username = UsernameField(
        label='Login',
        widget=forms.TextInput(attrs={
            'autofocus': True,
            'class': 'form-control'
        }),
    )
    password = forms.CharField(
        label=_("Password"),
        widget=forms.PasswordInput(attrs={'class': 'form-control'}),
    )
示例#21
0
class LoginForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(
        attrs={
            'autofocus': True,
            'class': 'form-control form-group col-md-4'
        }))
    password = forms.CharField(
        label=("Password"),
        strip=False,
        widget=forms.PasswordInput(attrs={
            'autocomplete': True,
            'class': 'form-control form-group col-md-4'
        }))
示例#22
0
class AuthForm(AuthenticationForm):
    """Custom authentication form."""

    username = UsernameField(
        widget=forms.TextInput(
            attrs={'autofocus': True, 'class': 'input is-rounded'}
        )
    )
    password = forms.CharField(
        label=_("Password"),
        strip=False,
        widget=forms.PasswordInput(attrs={'class': 'input is-rounded'}),
    )
示例#23
0
class PrettyLoginForm(AuthenticationForm):
    username = UsernameField(
        max_length=254,
        widget=forms.TextInput(attrs={
            'autofocus': True,
            'class': 'form-control'
        }),
    )
    password = forms.CharField(
        label='Пароль',
        strip=False,
        widget=forms.PasswordInput(attrs={'class': 'form-control'}),
    )
示例#24
0
class LoginForm(AuthenticationForm):
	username = UsernameField(widget=forms.TextInput( attrs={
		'autofocus':True,
		'class':'for-control',
		'placeholder':'Codigo'

	}))
	password = forms.CharField(
		strip=False,
		widget=forms.PasswordInput(attrs={
		'class':'form-control',
		'placeholder':'Contraseña'
	}))
示例#25
0
class OrganizingHubLoginForm(AuthenticationForm):
    username = UsernameField(label=_("Email Address"),
                             widget=forms.TextInput(attrs={'autofocus': True}),
                             help_text='''
            This can be any email address with an Our Revolution account. To
            manage your group or nominate candidates, use a registered group
            leader or group admin email.
        ''')
    error_messages = {
        'invalid_login':
        _("The email address or password you entered is invalid."),
        'inactive': _("This account is inactive."),
    }
示例#26
0
class LogInForm(AuthenticationForm):
    username = UsernameField(widget=TextInput(attrs={
        'autofocus': True,
        'class': 'input'
    }))
    password = CharField(
        label=_("Password"),
        strip=False,
        widget=PasswordInput(attrs={
            'autocomplete': 'current-password',
            'class': 'input'
        }),
    )
示例#27
0
class AuthenticationForm(AuthenticationForm):
    username = UsernameField(widget=forms.TextInput(attrs={
        'autofocus': True,
        'placeholder': 'Username'
    }))
    password = forms.CharField(
        label=_("Password"),
        strip=False,
        widget=forms.PasswordInput(attrs={
            'autocomplete': 'current-password',
            'placeholder': 'Password'
        }),
    )
示例#28
0
class UserLoginForm(AuthenticationForm):
    username = UsernameField(
        label='Имя',
        widget=forms.TextInput(attrs={'autofocus': True}),
    )

    error_messages = {
        'invalid_login':
        '******'.join([
            'Имя пользователя и пароль не совпадают.',
            'Введите правильные данные.',
        ], ),
    }
class LoginForm(forms.Form):
    username = UsernameField(widget=forms.TextInput(attrs={'autofocus': True,
                                                           'class': 'form-control',
                                                           'placeholder': 'Username'
                                                           }))
    password = forms.CharField(
        label=_("Password"),
        strip=False,
        widget=forms.PasswordInput(attrs={
            'class': 'form-control',
            'placeholder': 'Password'
        }),
    )
示例#30
0
class LoginForm(AuthenticationForm):
    username = UsernameField(
        max_length=254,
        widget=forms.TextInput(attrs={'autofocus': True,
                                      'class': 'input',
                                      'placeholder': 'Кликуха'}),
    )
    password = forms.CharField(
        label="Пароль",
        strip=False,
        widget=forms.PasswordInput(attrs={"class": "input",
                                          "placeholder": "Пароль"}),
    )