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 SignupForm(Form): username = TextField('Username', validators=[ Required('Required Field'), Length(min=1, message=(u'Username too short')) ]) fname = TextField('First name', validators=[Required('Required Field')]) lname = TextField('Last name', validators=[Required('Required Field')]) email = TextField('Email address', validators=[ Required('Please provide a valid email address!'), Length(min=2, message=(u'Email address too short')), Email(message=(u'That\'s not a valid email address')) ]) password = PasswordField( 'Pick a secure password', validators=[ Required('Required Field'), Length(min=0, message=(u'Please give a longer password.')), EqualTo('confirm', message='Passwords must match') ]) confirm = PasswordField('Please repeat your password') recaptcha = RecaptchaField() agree = BooleanField( 'By clicking Join now, you agree to <a href="#">Crowkast\'s User Agreement</a>', validators=[Required(u'You must accept our Terms of Service')])
class ActivateForm(Form): name = StringField("Name", validators=[Required(), Length(1, 256)], description="Leonhard Euler") username = StringField("Username", validators=[ Required(), Length(1, 64), Regexp( "^[A-Za-z][A-Za-z0-9_.]*$", 0, "Usernames must have only letters, " "numbers, dots or underscores") ], description="7Bridges") password = PasswordField("Password", validators=[Length(8, 256), Required()], description="??????") password2 = PasswordField("Confirm password", validators=[Required(), \ EqualTo("password", message="Passwords must match")], description="??????") tos = BooleanField( "I agree to the <a href=\"/terms/\">Terms and Conditions</a> and the <a href=\"/privacy-policy/\">Privacy Policy</a>.", validators=[ Required( message= "You must agree to these terms to create or activate an account." ) ]) recaptcha = RecaptchaField() submit = SubmitField("Submit") def validate_username(self, field): if User.query.filter_by(username=field.data.lower().strip()).first(): raise ValidationError("Username already in use.")
class ContactForm(Form): email = StrippedTextField(u'Email', \ validators=[Length(min=0,max=100), Required()]) subject = StrippedTextField(u'Subject', \ validators=[Length(min=0,max=100), Required()]) comments = TextAreaField(u'Comments', validators=[Required()]) recaptcha = RecaptchaField()
class ProblemForm(Form): answer = TextField("Answer", validators=[Required()]) if not app.config["DEBUG"]: recaptcha = RecaptchaField() submit = SubmitField("Submit")
class SignupForm(Form): email = TextField('Email address', validators=[ DataRequired('Please provide a valid email address'), Email(message=(u'That\'s not a valid email address')) ]) password = PasswordField( 'Pick a secure password', validators=[ DataRequired('Please enter a password'), Length(min=6, message=(u'Password must be at least 6 characters')) ]) confirm_password = PasswordField( 'Confirm password', validators=[ EqualTo('password', message='Password confirmation did not match') ]) username = TextField('Username', validators=[DataRequired()]) forename = TextField('Forename') surname = TextField('Surname') agree = BooleanField( 'By signing up your agree to follow our <a href="#">Terms and Conditions</a>', validators=[DataRequired(u'You must agree the Terms of Service')]) remember_me = BooleanField('remember_me', default=False) recaptcha = RecaptchaField()
class RegistrationForm(Form): email = StringField('Email', validators=[DataRequired(), Length(1, 64), Email()]) username = StringField('Username', validators=[ DataRequired(), Length(1, 64), Regexp('^[A-Za-z][A-Za-z0-9_.]*$', 0, 'Usernames must have only letters, ' 'numbers, dots or underscores')]) password = PasswordField('Password', validators=[ DataRequired(), EqualTo('confirm_password', message='Passwords must match.')]) confirm_password = PasswordField('Confirm password', validators=[DataRequired()]) if BaseConfig.RECAPTCHA_ENABLE == 'yes': recaptcha = RecaptchaField() submit = SubmitField('Register') @staticmethod def validate_email(field): if User.query.filter_by(email=field.data).first(): raise ValidationError('Email already registered.') @staticmethod def validate_username(field): if User.query.filter_by(username=field.data).first(): raise ValidationError('Username already in use.')
class UserRegistration(Form): username = TextField( "Username", validators=[ Not(MatchesRegex("[^0-9a-zA-Z\-_]"), message= "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.") ]) captcha = RecaptchaField()
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 OpenIdSignupForm(Form): next = HiddenField() username = TextField( _("Username"), validators=[required(_("Username required")), is_username]) email = TextField(_("Email address"), validators=[ required(message=_("Email address required")), email(message=_("Valid email address required")) ]) recaptcha = RecaptchaField(_("Copy the words appearing below")) submit = SubmitField(_("Signup")) def validate_username(self, field): user = User.query.filter(User.username.like(field.data)).first() if user: raise ValidationError, gettext("This username is taken") 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 SignupForm(Form): email = StringField( 'Email', validators=[ DataRequired('Please provide a valid email address'), Email(message=(u'That\'s not a valid email address')) ]) password = PasswordField( 'Pick a secure password', validators=[ DataRequired('Please enter a password'), Length(min=6, message=(u'Password must be at least 6 characters')) ]) confirm_password = PasswordField( 'Confirm password', validators=[ EqualTo('password', message='Password confirmation did not match') ]) username = StringField( 'Username', validators=[ DataRequired(), Length(min=1, message='Username is too short'), Regexp( '^[A-Za-z][A-Za-z0-9_.\- ]*$', 0, 'Usernames must have only letters, numbers, dots, dashes, underscores, or spaces' ) ]) forename = StringField( 'Forename', validators=[ Optional(), Length(min=1, message='Forename is too short'), Regexp( '^[A-Za-z][A-Za-z0-9_.\- ]*$', 0, 'Forenames must have only letters, numbers, dots, dashes, underscores, or spaces' ) ]) surname = StringField( 'Surname', validators=[ Optional(), Length(min=1, message='Forename is too short'), Regexp( '^[A-Za-z][A-Za-z0-9_.\- ]*$', 0, 'Surnames must have only letters, numbers, dots, dashes, underscores, or spaces' ) ]) agree = BooleanField( 'By signing up your agree to follow our <a href="#">Terms and Conditions</a>', validators=[DataRequired(u'You must agree the Terms of Service')]) remember_me = BooleanField('Remember me', default=True) recaptcha = RecaptchaField() submit = SubmitField('Sign-up') def validate_email(self, field): if User.query.filter_by(email=field.data).first(): raise ValidationError( 'This email address has already been registered')
class RequestPasswordResetForm(Form): email = StringField("Email", validators=[Required(), Length(1, 64), Email()], description="*****@*****.**") recaptcha = RecaptchaField() submit = SubmitField("Request Reset")
class ThreadForm(Form): text = TextAreaField("Body", validators=[Required(message="You must enter text.")]) if not app.config["DEBUG"]: recaptcha = RecaptchaField() submit = SubmitField("Submit")
class CommentForm(Form): name = TextField(lazy_gettext("Your Name"), validators=[RequiredIf(not_logged_in), Length(max=80)]) text = TextAreaField(lazy_gettext("Comment")) captcha = RecaptchaField( validators=[OptionalIf(logged_in), RecaptchaValidator()])
class MailListForm(Form): email = email = TextField("Email", validators=[ InputRequired("Please enter your email."), Email("Email must be valid") ]) recaptcha = RecaptchaField() submit = SubmitField("Send")
class ContactForm(Form): email = EmailField("Email", [validators.Email()]) subject = SelectField("Subject", choices=[('Voting Help', 'Voting Help'), ('Account Help', 'Account Help'), ('Bug/Error', 'Bug/Error')]) message = TextAreaField("Message", [validators.Required()]) recaptcha = RecaptchaField([validators.Required()]) submit = SubmitField("Submit")
class SignUpForm(Form): username = TextField('username', validators=[Required()]) email = TextField('email address', [Required(), Email()]) password = PasswordField('password', validators=[Required()]) confirm = PasswordField('repeat password', [ Required(), EqualTo('password', message='passwords must match') ]) recaptcha = RecaptchaField()
class ResetPasswordForm(Form): token = HiddenField() password = PasswordField(_('New Password'), [Required()]) confirm = PasswordField( _('Confirm Password'), [Required(), EqualTo('password', message=_('Passwords must match'))]) recaptcha = RecaptchaField()
class RegisterForm(Form): name = TextField(label=gettext('Username'), validators=[Required(message=gettext('Username is required'))], default='') email = TextField(gettext('Email address'), [Required(message=gettext('Email is required')), Email(message=gettext('Invalid email address'))], default='') password = PasswordField(gettext('Password'), [Required(message=gettext('Password is required'))], default='') confirm = PasswordField(gettext('Repeat Password'), [ Required(message=gettext('You have to confirm your password')), EqualTo('password', message=gettext('Passwords must match')) ], default='') recaptcha = RecaptchaField()
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()]) recaptcha = RecaptchaField()
class ClubForm(Form): name = TextField(_('Club Name'), [Required()]) game = SelectField( _('Game'), [Required()], choices=Club.choices_for('game').items(), ) recaptcha = RecaptchaField()
class ExampleForm(Form): field1 = TextField('First Field', description='This is field one.') field2 = TextField('Second Field', description='This is field two.', validators=[Required()]) hidden_field = HiddenField('You cannot see this', description='Nope') recaptcha = RecaptchaField('A sample recaptcha field') def validate_hidden_field(form, field): raise ValidationError('Always wrong')
class EmailForm(Form): email = TextField( "Email", validators=[Required(message="You must enter an email."), Email()]) if not app.config["DEBUG"]: recaptcha = RecaptchaField() submit = SubmitField("Submit")
class RegistrationForm(Form): name = TextField("Name", [validators.Required()]) email = EmailField("Email", [validators.Email()]) password = PasswordField('Password', [ validators.Required(), validators.EqualTo('confirm', message='Passwords must match') ]) confirm = PasswordField('Repeat Password') recaptcha = RecaptchaField() submit = SubmitField("Submit")
class RegisterForm(Form): name = TextField(_('Name')) email = TextField(_('Email'), [Required(), Email()]) password = PasswordField(_('Password'), [Required()]) confirm = PasswordField( _('Confirm Password'), [Required(), EqualTo('password', message=_('Passwords must match'))]) recaptcha = RecaptchaField()
class ContactForm(Form): """Contact form""" name = TextField(label="Name", validators=[Length(max=35), Required()]) email = EmailField(label="Email address", validators=[Length(min=6, max=120), Email()]) message = TextAreaField(label="Message", validators=[Length(max=1000), Required()]) recaptcha = RecaptchaField(label="reCAPTCHA")
class RegistrationForm(Form): full_name = TextField('Full name', [validators.Length(min=4, max=25)]) email = TextField('Email Address', [validators.Length(min=5, max=35), validators.Email(), UserExists('User already exists')]) password = PasswordField('New Password', [ validators.Required(), validators.EqualTo('confirm', message='Passwords must match') ]) confirm = PasswordField('Repeat Password') recaptcha = RecaptchaField()
class ArticleCreateForm(Form): title = StringField('Title', [validators.DataRequired("Please enter a title.")], filters=[strip_filter]) body = TextAreaField('Body', [validators.DataRequired("Please enter Somthing.")], filters=[strip_filter]) category = QuerySelectField('Category', query_factory=category_choice) tags = QuerySelectMultipleField('Tags', query_factory=tag_choice) author_name = StringField('name') recaptcha = RecaptchaField('are you real')
class ContactUsForm(Form): "Simple Contact Us form" name = TextField('Name', [validators.Required()]) email = TextField('e-mail', [validators.Required(), validators.Email()]) if 're_captcha_public' in CONFIG.options: captcha = RecaptchaField( public_key=CONFIG.options['re_captcha_public'], private_key=CONFIG.options['re_captcha_private'], secure=True) company = TextField('Company') comment = TextAreaField('Comment') country = Many2OneField('Country', model='country.country', optional=True) phone = TextField('Phone') website = TextField('Website')
class RegistrationForm(Form): username = TextField(validators=[Required()]) email = TextField(validators=[Email()]) password = PasswordField(validators=[ Required(), EqualTo('confirm_password', message='Passwords did not match') ]) confirm_password = PasswordField(validators=[Required()]) recaptcha = RecaptchaField() def validate_login(self, field): if db.session.query(User).filter_by( username=self.username.data).count() > 0: raise validators.ValidationError('Duplicate username')