class RegistrationForm(Form): username = TextField(u'Введите логин', [validators.Length(min=4, max=25)]) password = PasswordField(u'Введите пароль', [ validators.Required(), validators.EqualTo('confirm', message=u'Пароли должны совпадать') ]) confirm = PasswordField(u'Повторите Ваш пароль еще раз')
class UserNewForm(Form): username = TextField(u'用户名', validators=[required(message=u'必填')]) name = TextField(u'真实姓名', validators=[required(message=u'必填')]) password = PasswordField( u'密码', validators=[required(message=u'必填'), v.Length(min=6, max=20)]) password_confirm = PasswordField(u'重复密码', validators=[ required(message=u'必填'), equal_to('password', message=u'两次输入的密码不同') ]) role_id = SelectFieldPro( u'角色', validators=[required(message=u'必填')], choices=lambda: [('', u'请选择角色')] + [(unicode(r.id), r.name) for r in Role.query]) domain_id = SelectFieldPro( u'管理域', validators=[required(message=u'必填')], choices=lambda: [('', u'请选择管理域')] + [(unicode(d.id), d.name) for d in Domain.query]) department = TextField(u'部门') email = TextField( u'邮箱', validators=[required(message=u'必填'), email(message=u'不是合法的邮箱地址')]) telephone = TextField(u'电话') mobile = TextField(u'手机', validators=[validate_mobile()]) memo = TextAreaField(u'备注')
class ChangePasswordForm(Form, PasswordFormMixin): """The default change password form""" new_password = PasswordField( get_form_field_label('new_password'), validators=[password_required, Length(min=6, max=128)]) new_password_confirm = PasswordField( get_form_field_label('retype_password'), validators=[ EqualTo('new_password', message='RETYPE_PASSWORD_MISMATCH') ]) submit = SubmitField(get_form_field_label('change_password')) def validate(self): if not super(ChangePasswordForm, self).validate(): return False if self.password.data.strip() == '': self.password.errors.append( get_message('PASSWORD_NOT_PROVIDED')[0]) return False if not verify_and_update_password(self.password.data, current_user): self.password.errors.append(get_message('INVALID_PASSWORD')[0]) return False return True
class ResetPasswordForm(Form): username = TextField(u'用户名') newpasswd = PasswordField(u'新密码', [ v.Required(message=u'必填'), v.Length(min=6, max=20), v.EqualTo('confirm', message=u'确认密码不匹配') ]) confirm = PasswordField(u"确认密码", [v.Required(message=u'必填')])
class PasswordForm(Form): oldpasswd = PasswordField(u"当前密码", [v.Required(message=u'必填')]) newpasswd = PasswordField(u'新密码', [ v.Required(message=u'必填'), v.Length(min=6, max=20), v.EqualTo('confirm', message=u'确认密码不匹配') ]) confirm = PasswordField(u"确认密码", [v.Required(message=u'必填')])
class RegistrationForm(Form): username = StringField('Username', [validators.Length(min=4, max=25)]) email = StringField('Email Address', [validators.Length(min=6, max=35)]) password = PasswordField('New Password', [ validators.DataRequired(), validators.EqualTo('confirm', message='Passwords must match') ]) confirm = PasswordField('Repeat Password') accept_tos = BooleanField('I accept the TOS', [validators.Required()])
class RegisterForm(Form): """ The register form. """ username = TextField('Username', [validators.Required(), validators.Length(min=1, max=80), username_check]) password = PasswordField('Password', [validators.Required()]) password_repeat = PasswordField('Repeat password', [validators.EqualTo('password', message='Passwords must match.')]) email = EmailField('Email', [validators.Required(), email_check]) recaptcha = RecaptchaField()
class SignupForm(Form): email = TextField('Email', validators=[Required(), Email()]) password = PasswordField('Password', validators=[Required()]) repeat_password = PasswordField( 'Repeat Password', validators=[ Required(), EqualTo('password', message="Your passwords do not match") ]) def validate_email(self, field): if User.query.filter_by(email=field.data).count(): raise ValidationError('User with this email is already signed up')
class UserForm(Form): """ The user form. """ username = TextField( 'Username', [validators.Required(), validators.Length(min=1, max=80)]) current_password = PasswordField('Current password', [validators.Optional()]) new_password = PasswordField('New password', [validators.Optional()]) new_password_repeat = PasswordField( 'Repeat new password', [validators.EqualTo('new_password', message='Passwords must match.')]) email = EmailField('Email', [validators.Required()]) networks = FieldList(FormField(UserMemberForm)) admin_flag = BooleanField('Has administrative privileges')
class LoginForm(Form): def __init__(self, *args, **kwargs): Form.__init__(self, *args, **kwargs) self.user = None login = TextField(u'Login', validators=[ validators.required(), ]) password = PasswordField(u'Password', validators=[ validators.required(), ]) remember = BooleanField(u'Remember me') submit = SubmitField(u'Validate') def validate(self): rv = Form.validate(self) if not rv: return False pseudo = self.login.data password = self.password.data try: user_exists(self, self.login) user = check_password(pseudo, password) if user is None: self.password.errors.append('Wrong password.') return False except ValidationError: self.login.errors.append('Unknow user.') return False self.user = user return True
class ChangePasswordForm(Form): old_password = PasswordField('Old Password', validators=[Required()]) new_password = PasswordField('New Password', validators=[Required()]) repeat_new_password = PasswordField( 'Repeat New Password', validators=[ Required(), EqualTo('new_password', message="Your passwords don't match") ]) def __init__(self, **kwargs): super(ChangePasswordForm, self).__init__(**kwargs) self.user = kwargs['user'] def validate_old_password(self, field): if not self.user.check_password(field.data): raise ValidationError('Incorrect old password')
class RegisterForm(Form): login = TextField(u'Login', validators=[ validators.required(), unique_user, ]) password = PasswordField( u'Password', validators=[ validators.required(), validators.length(min=app.config['MIN_PASSWORD_LENGTH']), ]) password_confirmation = PasswordField( u'Password confirmation', validators=[ validators.required(), validators.length(min=app.config['MIN_PASSWORD_LENGTH']), ]) submit = SubmitField(u'Register') def __init__(self, *args, **kwargs): Form.__init__(self, *args, **kwargs) self.user = None def validate(self): rv = Form.validate(self) if not rv: return False pseudo = self.login.data password = self.password.data password_confirmation = self.password_confirmation.data if password != password_confirmation: self.password.errors.append('Passwords mismatch') self.password_confirmation.errors.append('Passwords mismatch') return False self.user = User(pseudo, password) return True
class ProjectForm(EditProjectForm): id = TextField(_("Project identifier"), validators=[Required()]) password = PasswordField(_("Private code"), validators=[Required()]) submit = SubmitField(_("Create the project")) def validate_id(form, field): form.id.data = slugify(field.data) if (form.id.data == "dashboard") or Project.query.get(form.id.data): raise ValidationError( Markup( _("The project identifier is used " "to log in and for the URL of the project. " "We tried to generate an identifier for you but a project " "with this identifier already exists. " "Please create a new identifier " "that you will be able to remember.")))
class LoginForm(Form, NextFormMixin): """The default login form""" email = TextField(get_form_field_label('email')) password = PasswordField(get_form_field_label('password')) remember = BooleanField(get_form_field_label('remember_me')) submit = SubmitField(get_form_field_label('login')) def __init__(self, *args, **kwargs): super(LoginForm, self).__init__(*args, **kwargs) def validate(self): if not super(LoginForm, self).validate(): return False if self.email.data.strip() == '': self.email.errors.append(get_message('EMAIL_NOT_PROVIDED')[0]) return False if self.password.data.strip() == '': self.password.errors.append( get_message('PASSWORD_NOT_PROVIDED')[0]) return False self.user = _datastore.find_user(email=self.email.data) if self.user is None: self.email.errors.append(get_message('USER_DOES_NOT_EXIST')[0]) return False if not verify_and_update_password(self.password.data, self.user): self.password.errors.append(get_message('INVALID_PASSWORD')[0]) return False if requires_confirmation(self.user): self.email.errors.append(get_message('CONFIRMATION_REQUIRED')[0]) return False if not self.user.is_active(): self.email.errors.append(get_message('DISABLED_ACCOUNT')[0]) return False return True
class EmailPasswordform(Form): email = stringField('Email', validators=[DataRequired(), Email()]) password = PasswordField('Password', validators=[DataRequired()])
class PasswordConfirmFormMixin(): password_confirm = PasswordField( get_form_field_label('retype_password'), validators=[EqualTo('password', message='RETYPE_PASSWORD_MISMATCH')])
class PasswordFormMixin(): password = PasswordField(get_form_field_label('password'), validators=[password_required])
class NewPasswordFormMixin(): password = PasswordField( get_form_field_label('password'), validators=[password_required, Length(min=6, max=128)])
class SigninForm(Form): email = TextField('Email', validators=[Required(), Email()]) password = PasswordField('Password', validators=[Required()])
class LoginForm(Form): username = TextField('username') password = PasswordField('password') submit = SubmitField('Login')
class LoginForm(Form): login = TextField('login', validators=[Required()]) password = PasswordField('password', validators=[Required()]) remember_me = BooleanField('remember_me', default=False)
class LoginForm(Form): username = TextField(u'用户名') password = PasswordField(u'密码') next = HiddenField() remember = BooleanField(u'记住我')
class PasswordFormMixin(): password = PasswordField( _("Password"), validators=[Required(message=_("Password not provided"))])
class PasswordConfirmFormMixin(): password_confirm = PasswordField( _("Retype Password"), validators=[EqualTo('password', message=_("Passwords do not match"))])
class LoginForm(Form): email = TextField('Email', [validators.Length(min=6, max=35), validators.Email()]) password = PasswordField('Password', [Required()])
class RegistrationForm(Form): name = TextField('Name', [validators.Length(min=1, max=25)]) email = TextField('Email', [validators.Length(min=6, max=35), validators.Email()]) password = PasswordField('Password', [Required()])
class AuthenticationForm(Form): id = TextField(_("Project identifier"), validators=[Required()]) password = PasswordField(_("Private code"), validators=[Required()]) submit = SubmitField(_("Get in"))
def scaffold_form(self): form = super(UserView, self).scaffold_form() form.pw_hash = PasswordField(validators=[required()]) form.roles.kwargs['validators'] = [] return form
class LoginForm(Form): email = TextField() password = PasswordField()