Ejemplo n.º 1
0
class ProfileForm(Form):
    password = PasswordField('New Password',
                             validators=[
                                 Optional(),
                                 Length(min=8, max=80),
                                 EqualTo('confirm',
                                         message='Passwords must match')
                             ])
    confirm = PasswordField('Repeat Password')
    default_ipv4_mask = IntegerField(
        label='IPv4 Mask',
        validators=[
            Optional(),
            NumberRange(min=0,
                        max=32,
                        message='IPv4 Mask must between %(min)s and %(max)s'),
        ])
    default_ipv6_mask = IntegerField(
        label='IPv6 Mask',
        validators=[
            Optional(),
            NumberRange(min=0,
                        max=128,
                        message='IPv6 Mask must between %(min)s and %(max)s'),
        ])
    timezone = QuerySelectField(get_label='name', allow_blank=True)
    submit = SubmitField('Update Profile')
Ejemplo n.º 2
0
class EditProfileForm(Form):
    username = TextField(
        "Username",
        validators=[
            Regexp('^[a-zA-Z0-9_.-]+$',
                   message="Username contains invalid characters"),
            Length(min=2,
                   max=16,
                   message="Username must be between 2 and 16 characters"),
            username_same_or_exists, does_not_have_bad_words
        ])

    email = TextField("Email Address",
                      validators=[
                          Required(message='Email required'),
                          Email(message="Invalid email address")
                      ])

    password = PasswordField(
        "Change Password",
        validators=[
            Length(min=4,
                   max=32,
                   message="Username must be between 2 and 16 characters"),
            EqualTo('password2', message='Passwords must match'),
            Optional()
        ])

    password2 = PasswordField("Repeat password", validators=[Optional()])
Ejemplo n.º 3
0
class SignUpForm(Form):
    ID = TextField(u'身份證字號', validators=[check_ID, NoneOf(ExistingUsersID(), u'此身份證字號已存在,請確認是否已註冊')])
    mobile_phone = TextField(u'行動電話', validators=[Regexp(r'^09\d{8}$', message=u'行動電話號碼格式不正確')])
    email = TextField(u'電子郵件', validators=[Email(u'電子郵件位址格式不正確')])
    password = PasswordField(u'密碼', validators=[Required(u'請設定密碼')])
    chk_password = PasswordField(u'確認密碼', validators=[EqualTo('password', u'兩次輸入的密碼不相符')])
    recaptcha = RecaptchaField(u'圖形驗證', validators=[check_recaptcha_filled, Recaptcha(u'輸入錯誤,請再試一遍')])
Ejemplo n.º 4
0
class ResetPasswordForm(Form):
    new_password = PasswordField("New Password",
                                 validators=[
                                     Required(message='Password required'),
                                     EqualTo('confirm',
                                             message='Passwords must match')
                                 ])
    confirm_password = PasswordField("Confirm passowrd")
Ejemplo n.º 5
0
class RegisterForm(Form):
    nickname = TextField(u'昵称', [Required(), Length(min=3, max=12)])
    email = TextField(u'邮件地址', [Length(min=6, max=30), Email(), email_unique])
    password = PasswordField(u'密码', [Length(min=6, max=12), Required()])
    password_confirm = PasswordField(
        u'密码确认',
        [Required(), EqualTo('password', message=u'密码必须相同')])
    captcha = TextField(u'验证码', [Required()])
Ejemplo n.º 6
0
class RegisterForm(Form):
    password = PasswordField('Password',
                             validators=[
                                 Required(),
                                 EqualTo('confirm',
                                         message='Passwords must match')
                             ])
    confirm = PasswordField('Repeat Password')
Ejemplo n.º 7
0
class RegisterForm(Form):
    email = EmailField('Email Address',
                       validators=[],
                       description="Enter your email address.")
    password = PasswordField('Password',
                             validators=[
                                 Required(),
                                 EqualTo('confirm',
                                         message='Passwords must match')
                             ])
    confirm = PasswordField('Repeat Password')
Ejemplo n.º 8
0
class RegisterForm(Form):
    email = TextField('Email Address', validators = [Email()])
    password = PasswordField('New Password', validators=[
            Required(),
            Length(min=8, max=80),
            EqualTo('confirm', message='Passwords must match')
    ])
    confirm = PasswordField('Repeat Password')
    accept_tos = BooleanField('I accept the TOS', validators = [Required()])
    timezone = QuerySelectField(get_label='name', allow_blank=True)
    submit = SubmitField('Register')
Ejemplo n.º 9
0
class RegisterForm(Form):
    email = TextField(u'邮箱地址*', validators=[Required(), Email()])
    nickname = TextField(u'昵称*',
                         validators=[Required(),
                                     Regexp('[\w\d-]{2,20}')])
    passwd = PasswordField(u'密码*',
                           validators=[Required(),
                                       Regexp('[\w\d-]{5,20}')])
    confirm = PasswordField(
        u'确认密码*', validators=[Required(),
                              EqualTo('passwd', message=u'密码不一致')])
    agree = BooleanField(u'我已经认真阅读并同意',
                         default=True,
                         validators=[BeTrue(u'同意此协议才能注册')])