Beispiel #1
0
class RegistrationForm(Form):
    name = TextField('name', validators=[Required(), Length(max=300)])
    email = TextField('email', validators=[Email(), Required(), Length(max=254)])
    password = PasswordField('password', validators=[Required(), Length(min=5, max=300)],
                             widget=PasswordInput(False))
    password2 = PasswordField('password2',
                              validators=[
                                  Required(), EqualTo('password', "Passwords must be identical")
                              ], widget=PasswordInput(False))

    def validate(self):
        rv = Form.validate(self)
        if not rv:
            return False

        if User.email_registred(self.email.data):
            self.email.errors.append('Email already registred!')
            return False
        return True
Beispiel #2
0
 def test_password_input(self, basic_widget_dummy_field):
     assert 'type="password"' in PasswordInput()(basic_widget_dummy_field)
     assert 'value=""' in PasswordInput()(basic_widget_dummy_field)
     assert 'value="foo"' in PasswordInput(hide_value=False)(
         basic_widget_dummy_field
     )
Beispiel #3
0
class PasswordField(PasswordField):
    # 修改PasswordInput参数值显示密码
    widget = PasswordInput(hide_value=False)
Beispiel #4
0
class VisiblePasswordField(PasswordField):
  widget = PasswordInput(hide_value= False)
Beispiel #5
0
class MyPasswordField(PasswordField):
    '''
    custom password field to display
    '''
    widget = PasswordInput(hide_value=False)
Beispiel #6
0
class LoginForm(Form):
    email = TextField('email', validators=[Email(), Required(), Length(max=254)])
    password = PasswordField('password', validators=[Required(), Length(min=5, max=300)],
                             widget=PasswordInput(False))
Beispiel #7
0
class MyPasswordField(PasswordField):
    widget = PasswordInput(hide_value=False)