class SignupForm(Form): next = HiddenField() username = TextField( u"用户名", validators=[required(message=_("Username required")), is_username]) password = PasswordField( u"密码", validators=[required(message=_("Password required"))]) password_again = PasswordField(u"密码确认", validators=[ equal_to("password", message=\ _("Passwords don't match"))]) email = TextField(u"邮箱", validators=[ required(message=_("Email address required")), email(message=_("A valid email address is required")) ]) recaptcha = RecaptchaField(_("Copy the words appearing below")) submit = SubmitField(u"注册") def validate_username(self, field): user = User.query.filter(User.username.like(field.data)).first() if user: raise ValidationError, u"改用户名已存在" def validate_email(self, field): user = User.query.filter(User.email.like(field.data)).first() if user: raise ValidationError, gettext("This email is taken")
class ChangePasswordForm(Form): # TODO: NAME字段格式检查的中文支持 next_page = HiddenField() id = IntegerField(widget=HiddenInput()) now_password = PasswordField(u'Password') new_password = PasswordField( u'New Password', description=u'At least eight characters', validators=[ Optional(), Regexp(u'(^.{8,20}$)|(^$)', message=u'Password are at least eight chars'), Depend('now_password', message=u'Password is required when changing password') ]) confirm_password = PasswordField( u'Confirm Password', description=u'Re-enter the new password', validators=[ Optional(), EqualTo('new_password', message=u'New passwords must be the same') ]) submit = SubmitField(u'Submit', id='submit')
class Password(Form): password = PasswordField('Password', [ validators.Required('How else will we know it’s really you?'), ]) retype = PasswordField('Password (again)', [ validators.EqualTo('password', message='If you can’t type it twice now, you’ll never be able to log in with it.') ])
class ParticipantRegistration(Form): username = TextField( "Username", validators=[ MatchesRegex( "[^0-9a-zA-Z\-_]", "Your username contains invalid characters. Only use alphanumeric characters, dashes and underscores." ), Not(UsernameExists(), message="That username already exists."), Length( min=3, max=80, message= "You have to enter a username of 3 to 80 characters length.") ]) password = PasswordField( "Password", validators=[ Length(min=8, message="Please enter a password of at least 8 characters.") ]) password2 = PasswordField( "Password, again", validators=[EqualTo("password", "Passwords do not match.")]) email = EmailField( "Email", validators=[ Not(EmailExists(), message="That email address is already in use."), Email(message="The email address you entered is invalid.") ]) receive_emails = BooleanField("I want to receive email notifications.", default=True) captcha = RecaptchaField()
class CreateUserForm(RedirectForm): name = TextField('name', validators=[Required()]) email1 = TextField('email1', validators=[Required()]) email2 = TextField('email2', validators=[Required()]) pass1 = PasswordField('pass1', validators=[Required()]) pass2 = PasswordField('pass2', validators=[Required()]) def validate(self): if request.form['button'] == 'Cancel': return True rv = Form.validate(self) if not rv: return False if self.email1.data != self.email2.data: self.email2.errors.append("Email addresses do not match") return False user = User.query.filter_by(email=self.email1.data).first() if user is not None: self.email2.errors.append("Email address is already registered") return False if self.pass1.data != self.pass2.data: self.pass2.errors.append("Passwords do not match") return False self.user = user return True
class RegisterForm(Form): username = TextField( label=_('Username'), validators=[ Required() ] ) email = EmailField( label=_('Email address'), validators=[ Required(), Email("That doesn't look like an email.") ] ) password = PasswordField( label=_('Password'), validators=[ Required(), Length( min=PASSWORD_LEN_MIN, max=PASSWORD_LEN_MAX, ) ] ) password_again = PasswordField( label=_('Repeat Password'), validators=[ Required(), EqualTo('password_again', message=_('Passwords must match.')) ] ) #recaptcha = RecaptchaField() submit = SubmitField(_('Create account'))
class UserRegForm(Form): name = TextField( u"用户名", validators=[Required(), Length(min=3, max=32), Regexp(re_username)]) email = TextField(u'Email', validators=[Required(), Email()]) gender = RadioField(u'性别', coerce=int, choices=[(0, u'男'), (1, u'女')], default=0, widget=BSListWidget()) password = PasswordField(u'密码', validators=[ Required(), Length(min=5, max=60), EqualTo('confirm', message='Passwords must match') ]) confirm = PasswordField(u'确认密码', validators=[Required(), Length(min=5, max=60)]) def validate_name(form, field): name = field.data.lower() if name in reserved_words: raise ValidationError(u'用户名不能为系统保留字') user = User.query.filter(User.username == field.data).first() if user: raise ValidationError(u'该用户名已被注册') def validate_email(form, field): user = User.query.filter(User.email == field.data).first() if user: raise ValidationError(u'该email已被注册')
class SignupForm(Form): next = HiddenField() name = TextField(_('Username'), [required()]) password = PasswordField( _('Password'), [required(), length(min=PASSLEN_MIN, max=PASSLEN_MAX)]) password_again = PasswordField(_('Password again'), [ required(), length(min=PASSLEN_MIN, max=PASSLEN_MAX), equal_to('password') ]) email = TextField( _('Email address'), [required(), email(message=_('A valid email address is required'))]) invitation_code = TextField( _('Invitation Code'), [required(message=_('Please fill in the invitation code!'))]) submit = SubmitField(_('Signup')) def validate_name(self, field): if g.db.users.find_one({"_id": field.data}) is not None: raise ValidationError, _('This username is taken') def validate_email(self, field): if g.db.users.find_one({"email": field.data}) is not None: raise ValidationError, _('This email is taken') def validate_invitation_code(self, field): if g.db.invitates.find_one({ "code": field.data, "used": 'False' }) is None: raise ValidationError, _('Invalid code')
class SignupForm(Form): next = HiddenField() name = TextField( 'Username', [Required(), Length(USERNAME_LEN_MIN, USERNAME_LEN_MAX)], ) password = PasswordField( 'Password', [Required(), Length(PASSWORD_LEN_MIN, PASSWORD_LEN_MAX)], ) password_again = PasswordField( 'Password again', [ Required(), Length(PASSWORD_LEN_MIN, PASSWORD_LEN_MAX), EqualTo('password') ], ) email = EmailField( 'Email', [Required(), Email()], ) submit = SubmitField('Sign up') def validate_name(self, field): if User.query.filter_by(name=field.data).first() is not None: raise ValidationError, gettext('This username is taken') def validate_email(self, field): if User.query.filter_by(email=field.data).first() is not None: raise ValidationError, gettext('This email is taken')
class RegisterForm(Form): email = TextField('Email', validators['email']) password = PasswordField( 'Password', validators['password'], ) confirm = PasswordField('Confirm Password')
class CreateLogin(Form): fname = TextField('*First Name', validators=[Required()]) lname = TextField('Last Name', validators=[Optional(strip_whitespace=True)]) mobile = TextField( 'Mobile', validators= # sets optional entry and strips whitespace [ Optional(strip_whitespace=True), v.Length(max=15, message='Mobile exceeds length') ]) zipcode = IntegerField('Zipcode', validators=[Optional(strip_whitespace=True)]) # v.NumberRange(max=9, # message='Zipcode exceeds length')]) email = TextField('*Email', validators=[ Required(), v.Email(), v.EqualTo('confirm_email', message="Emails must match") ]) confirm_email = TextField('*Confirm Email') bio = TextAreaField('Bio', validators=[Length(min=0, max=140)]) password = PasswordField('*Password', validators=[ Required(), v.EqualTo('confirm_password', message='*Passwords must match') ]) confirm_password = PasswordField('Confirm Password') remember_me = BooleanField('Remember Me', default=False) recaptcha = RecaptchaField('*Person Test')
class ChangePasswordForm(Form): activation_key = HiddenField() password = PasswordField(u'Password', [Required()]) password_again = PasswordField( u'Password again', [EqualTo('password', message="Passwords don't match")]) submit = SubmitField('Save')
class RegisterForm(Form): first_name = TextField('First Name', validators=[Required()], description="Your first name") last_name = TextField('Last Name', validators=[Required()], description="Your last name") email = TextField('Email address', validators=[Required(), Email()], description="Your email address") phone = TextField('Phone number', validators=[Required()], description="Your phone number") password = PasswordField('Password', validators=[ Required(), EqualTo('confirm', message='Passwords must match') ], description="Your password") confirm = PasswordField('', validators=[Required()], description="Confirm your password") def validate_phone(form, field): if not is_us_phone_number(field.data): raise ValidationError('Use the phone number format XXX-XXX-XXXX')
class UserForm(Form): first_name = TextField(u'First name', validators=[required()]) last_name = TextField(u'Last name', validators=[required()]) email_address = TextField(u'Email address', validators=[required(), Email()]) password = PasswordField( u'New password', validators=[Optional(), EqualTo('password_confirm')]) password_confirm = PasswordField(u'Password confirm', validators=[Optional()]) def __init__(self, formdata=None, obj=None, prefix='', **kwargs): super(UserForm, self).__init__(formdata, obj, prefix, **kwargs) if obj: self.user = obj else: self.user = None def validate_email_address(self, field): user = User.query.filter_by(email_address=field.data) \ .filter(User.id != self.user.id).first() if user: raise ValidationError('That email address is already in use') def save(self): self.user.first_name = self.first_name.data self.user.last_name = self.last_name.data self.user.email_address = self.email_address.data if len(self.password.data) > 1: self.user.password = self.password.data db.session.add(self.user) db.session.commit() return self.user
class ResetPasswordForm(Form): activation_key = HiddenField() password = PasswordField(u"新密码", validators=[required(message=u"新密码是必须的")]) password_again = PasswordField(u"密码 <small>(再一次)</small>", validators=[ equal_to("password", message=\ u"密码不匹配")]) submit = SubmitField(u"保存")
class RegistrationForm(Form): email = TextField('Email Address', [validators.Length(min=6, max=35)]) password = PasswordField('New Password', [ validators.Required(), validators.EqualTo('confirm', message='Passwords must match') ]) confirm = PasswordField('Repeat Password')
class SignupForm(Form): '''It is used for sign up, defines sign up form.''' next = HiddenField() username = TextField(_(u"用户名:"), validators=[ required(message=_(u"请输入用户名或者邮箱地址")), is_legal_name]) password = PasswordField(_(u"密码:"), validators=[ required(message=_(u"请输入密码"))]) password_again = PasswordField(_(u"确认密码:"), validators=[ equal_to(u"password", message= _(u"密码不一致"))]) email = TextField(_(u"邮箱地址:"), validators=[ required(message=_(u"请输入邮箱地址")), email(message=_(u"请输入有效的邮箱地址"))]) submit = SubmitField(_(u"注册")) def validate_username(self, field): user = User.query.filter(User.username.like(field.data)).first() if user: raise ValidationError(gettext(u"用户名已经存在")) def validate_email(self, field): user = User.query.filter(User.email.like(field.data)).first() if user: raise ValidationError(gettext(u"邮箱地址已经存在"))
class Signup(Form): email = TextField('Email address', [ validators.Required( 'It’s okay, we won’t email you unless you want us to.' ), validators.Email('Um, that doesn’t look like an email address.'), ]) password = PasswordField('Password', [ validators.Required('How else will we know it’s really you?'), validators.EqualTo( 'retype', message= 'If you can’t type it twice now, you’ll never be able to log in with it.' ) ]) retype = PasswordField('Password (again)') consent = BooleanField('Accept the Terms', [ validators.Required('Is there something you don’t agree with?') ]) def validate_email(form, field): if models.User.query.filter_by(email=field.data).count(): raise validators.ValidationError( 'Looks like you’ve already registered. Try logging in instead.' )
class RegisterForm(Form): """ User registration form """ email = TextField(_("Email address"), validators=[Required(message=_("Email not provided"))], description=_("Example") + ": [email protected]") nickname = TextField( _("Nickname"), validators=[Required(message=_("Nickname not provided"))], description=_("Example") + ": johnd") password = PasswordField( _("Password"), description=_( "The password phrase may contain punctuation, spaces, etc.")) password2 = PasswordField(_("Confirm password"), ) referer = HiddenField() action = HiddenField(default='login') submit = SubmitField(_("Register")) def validate_nickname(self, field): if nickname_valid_p(field.data) != 1: raise validators.ValidationError( _("Desired nickname %s is invalid.") % field.data) # is nickname already taken? try: User.query.filter(User.nickname == field.data).one() raise validators.ValidationError( _("Desired nickname %s already exists in the database.") % field.data) except SQLAlchemyError: pass def validate_email(self, field): field.data = field.data.lower() if email_valid_p(field.data.lower()) != 1: raise validators.ValidationError( _("Supplied email address %s is invalid.") % field.data) # is email already taken? try: User.query.filter(User.email == field.data).one() raise validators.ValidationError( _("Supplied email address %s already exists in the database.") % field.data) except SQLAlchemyError: pass def validate_password(self, field): CFG_ACCOUNT_MIN_PASSWORD_LENGTH = 6 if len(field.data) < CFG_ACCOUNT_MIN_PASSWORD_LENGTH: raise validators.ValidationError( _("Password must be at least %d characters long." % (CFG_ACCOUNT_MIN_PASSWORD_LENGTH, ))) def validate_password2(self, field): if field.data != self.password.data: raise validators.ValidationError(_("Both passwords must match."))
class ChangePassForm(Form): old_password = PasswordField('Password', [validators.Required()]) password = PasswordField('Password', [ validators.Length(min=6, max=35), validators.Required(), validators.EqualTo('confirm', message='Passwords must match') ]) confirm = PasswordField('Repeat Password')
class RegistrationForm(Form): name = TextField('Username', [Required()]) email = TextField('Email address', [Required(), Email()]) password = PasswordField('Password', [Required()]) confirm = PasswordField('Repeat Password', [ Required(), EqualTo('password', message='Passwords must match') ])
class AddUser(Form): user = TextField('user', [Required()]) password = PasswordField('password', [Required()]) confirm_pass = PasswordField('confirm_pass', [Required()]) email = TextField('username', [Required(), Email()]) perm = SelectField('perm', choices=[('steve', 'Steve'), ('helpdesk', 'Helpdesk'), ('admin', 'Admin')])
class ChangePasswordForm(Form): activation_key = HiddenField() password = PasswordField( 'Password', validators=[required(message=_('Password is required'))]) password_again = PasswordField(_('Password again'), validators=[ equal_to('password', message=\ _("Passwords don't match"))]) submit = SubmitField(_('Save'))
class RegisterForm(Form): """ 註冊用的表單 """ account = TextField(u"帳號", validators=[required()]) password = PasswordField(u"密碼", validators=[required()]) repassword = PasswordField(u"確認密碼", validators=[required()]) submit = SubmitField(u"註冊")
class ChangePasswordForm(Form): old_password = PasswordField(u'Old Password', validators=[Required()]) new_password = PasswordField(u'New Password', validators=[Required()]) confirm = PasswordField(u'Repeat Password', validators=[ Required(), EqualTo('new_password', message='Passwords must match') ])
class RegisterForm(Form): name = TextField('NickName', [Required()]) email = TextField('Email address', [Required(), Email()]) password = PasswordField('Password', [Required()]) confirm = PasswordField( 'Repeat Password', [Required(), EqualTo('confirm', message='Passwords must match')]) accept_tos = BooleanField('I accept the TOS', [Required()])
class SettingsForm(Form): email = TextField('Email', validators=[Required(), Email()]) password = PasswordField('New Password', validators=[ Required(), EqualTo('confirm', message='Passwords must match.') ]) confirm = PasswordField('Confirm', validators=[Required()])
class RegistrationForm(Form): username = TextField('Username', [validators.Length(min=4, max=25)]) email = TextField('Email Address', [validators.Length(min=6, max=35)]) zipcode = TextField('Zipcode', [validators.Length(min=5, max=35)]) password = PasswordField('New Password', [ validators.Required(), validators.EqualTo('confirm', message='Passwords must match') ]) confirm = PasswordField('Repeat Password') accept_tos = BooleanField('I accept the TOS', [validators.Required()])
class RegistrationForm(UserForm): LANGUAGES = [get_locale().language] password = PasswordField(lazy_gettext('login.placeholder.password'), [ validators.Required(), validators.EqualTo( 'confirm', message=lazy_gettext('signup.error.passwordsmatch')) ]) confirm = PasswordField( lazy_gettext('signup.placeholder.confirmpassword'))
class NewPassword(Form): password = PasswordField( "Password", validators=[ Length(min=8, message="Please enter a password of at least 8 characters.") ]) password2 = PasswordField( "Password, again", validators=[EqualTo("password", "Passwords do not match.")])