Exemple #1
0
class PasswordForm(forms.Form):
    password = forms.PasswordField(required=True, minlength=6, maxlength=128)
    password_repeat = forms.PasswordField(label='confirm password',
                                          data_check_repeat='password')

    layout = forms.Layout(forms.Fieldset('password', 'password_repeat'),
                          forms.Submit('Reset password',
                                       classes='btn btn-primary'),
                          showLabels=False)
Exemple #2
0
class PasswordForm(forms.Form):
    password = forms.PasswordField(required=True, maxlength=128)
    password_repeat = forms.PasswordField(label='Confirm password',
                                          data_check_repeat='password')

    def clean(self):
        password = self.cleaned_data['password']
        password_repeat = self.cleaned_data['password_repeat']
        if password != password_repeat:
            raise forms.ValidationError('Passwords did not match')
Exemple #3
0
class ChangePasswordForm(PasswordForm):
    old_password = forms.PasswordField()

    layout = forms.Layout(forms.Fieldset('old_password', 'password',
                                         'password_repeat'),
                          forms.Submit('Update password',
                                       classes='btn btn-primary'),
                          showLabels=False)
Exemple #4
0
class LoginForm(forms.Form):
    '''The Standard login form'''
    error_message = 'Incorrect username or password'
    username = forms.CharField(required=True, minlength=6, maxlength=30)
    password = forms.PasswordField(required=True, minlength=6, maxlength=128)

    layout = forms.Layout(forms.Fieldset(all=True),
                          forms.Submit('Login',
                                       classes='btn btn-primary btn-block',
                                       disabled="form.$invalid"),
                          showLabels=False)
Exemple #5
0
class ChangePasswordForm(PasswordForm):
    old_password = forms.PasswordField()

    def clean_old_password(self, value):
        request = self.request
        user = request.cache.user
        auth_backend = request.cache.auth_backend
        try:
            if user.is_authenticated():
                auth_backend.authenticate(request, user=user, password=value)
            else:
                raise AuthenticationError('not authenticated')
        except AuthenticationError as exc:
            raise forms.ValidationError(str(exc))
        return value
Exemple #6
0
class LoginForm(forms.Form):
    '''The Standard login form'''
    error_message = 'Incorrect username or password'
    username = forms.CharField(max_length=30)
    password = forms.PasswordField(max_length=60)

    def clean(self):
        '''Process login'''
        request = self.request
        permissions = request.app.permissions
        username = self.cleaned_data['username']
        user = yield permissions.get_user(request, username=username)
        if not user:
            raise forms.ValidationError(self.error_message)
        password = self.cleaned_data['password']
        try:
            user = yield permissions.authenticate_and_login(request,
                                                            user,
                                                            password=password)
        except AuthenticationError:
            raise forms.ValidationError(self.error_message)
        except LoginError as e:
            raise forms.ValidationError(str(e))
        coroutine_return(user)
Exemple #7
0
class LoginForm(forms.Form):
    '''The Standard login form'''
    error_message = 'Incorrect username or password'
    username = forms.SlugField(required=True, maxlength=30)
    password = forms.PasswordField(required=True, maxlength=128)
Exemple #8
0
class CreateUserForm(forms.Form):
    username = forms.CharField(max_length=30)
    email = forms.EmailField(required=False)
    password = forms.PasswordField(max_length=60)
Exemple #9
0
class ChangePasswordForm(PasswordForm):
    old_password = forms.PasswordField(maxlength=128)
Exemple #10
0
class ApplicationConfigForm(forms.Form):
    DOCKER_USER = forms.EmailField(required=False)
    DOCKER_EMAIL = forms.CharField(required=False)
    DOCKER_PASSWORD = forms.PasswordField(required=False)
    AWS_KEY = forms.CharField(required=False)
    AWS_SECRET = forms.CharField(required=False)