class UsersForm(FlaskForm): email = EmailField('Email address', [DataRequired(), Email()]) default_locale = SelectField('Language', choices=[('en', 'English'), ('de', 'Deutsch')], validators=[InputRequired()]) submit = SubmitField('Update')
class SignupForm(FlaskForm): first_name = StringField( label='First name', validators=[DataRequired(message='First name required')]) last_name = StringField( label='Last name', validators=[DataRequired(message='Last name required')]) email = EmailField( label='Email address', validators=[DataRequired(message='Email address required')]) password = PasswordField( label='Password', validators=[DataRequired(message='Password required')]) password_repeat = PasswordField(label='Repeat Password', validators=[ DataRequired(), EqualTo('password', message='Passwords must match') ]) def validate_email(self, email): users = User.query.filter_by(email=email.data).first() if users is not None: raise ValidationError( 'An account is already registered for that email address')
class RegisterForm(FlaskForm): email = EmailField('Почта', validators=[DataRequired()]) password = PasswordField('Пароль', validators=[DataRequired()]) password_again = PasswordField('Повторите пароль', validators=[DataRequired()]) name = StringField('Имя пользователя', validators=[DataRequired()]) about = TextAreaField("Немного о себе") submit = SubmitField('Зарегистрироваться')
class RegisterForm(Form): name = StringField('Name',[validators.Length(min=1,max=30)]) username = StringField('Username',[validators.Length(min=4,max=25)]) email = EmailField('Email',[validators.Length(min=6,max=50)]) password = PasswordField('Password', [ validators.DataRequired(), validators.EqualTo('confirm',message='Password do not match') ]) confirm = PasswordField('Confirm Password')
class MiscForm(FlaskForm): first_name = StringField( "Vorname", validators=[ DataRequired("Dieses Feld wird benötigt"), Length( min=1, max=255, message="Der Name muss zwischen 1 und 255 Zeichen lang sein") ]) last_name = StringField( "Name", validators=[ DataRequired("Dieses Feld wird benötigt"), Length( min=1, max=255, message="Der Name muss zwischen 1 und 255 Zeichen lang sein") ]) email = EmailField( "Mail", validators=[ DataRequired( message= "Ohne eine gültige Mail können wir uns nicht zurückmelden"), Email(message="Bitte gib eine gültige Email Adresse an"), Length( min=1, max=64, message="Die Email muss zwischen 1 und 255 Zeichen lang sein") ]) problem_description = StringField( "Beschreibung", validators=[ DataRequired("Bitte gibt eine Beschreibung an."), Length( min=30, max=5000, message= "Die Beschreibung muss zwischen 30 und 5000 Zeichen lang sein") ]) def create_inquiry(self): """ Create a new instance of MiscEnquiry with pre filled customer, description""" if not self.validate(): raise ValueError("Form is invalid") customer: Customer = Customer.query_by_mail(self.email.data) if not customer: customer = Customer.create(email=self.email.data) self.populate_obj(customer) inquiry = MiscInquiry.create(customer=customer, description=self.problem_description.data) return inquiry
class UpdateForm(FlaskForm): """Form for updating a user.""" password = PasswordField("Password", validators=[InputRequired(), Length(min=6)]) email = EmailField("Email", validators=[InputRequired()]) first_name = StringField("First Name", validators=[InputRequired(), Length(max=30)]) last_name = StringField("Last Name", validators=[InputRequired(), Length(max=30)])
class UserForm(BaseForm): username = StringField(u'Username', validators=[ DataRequired(), Length(max=User.NAME_LENGTH), Regexp(username_regex) ]) email = EmailField( u'E-Mail', validators=[DataRequired(), Length(max=User.EMAIL_LENGTH), Email()]) password = PasswordField(u'Password', validators=[ Optional(), Length(min=TRACKER_PASSWORD_LENGTH_MIN, max=TRACKER_PASSWORD_LENGTH_MAX) ]) role = SelectField(u'Role', choices=[(e.name, e.label) for e in [*UserRole]], default=UserRole.reporter.name, validators=[DataRequired()]) active = BooleanField(u'Active', default=True) random_password = BooleanField(u'Randomize password', default=False) submit = SubmitField(u'submit') def __init__(self, edit=False): super().__init__() self.edit = edit def validate(self): rv = BaseForm.validate(self) if not rv: return False if self.password.data and self.username.data in self.password.data: self.password.errors.append( 'Password must not contain the username.') return False if self.edit: return True user = User.query.filter( or_(User.name == self.username.data, User.email == self.email.data)).first() if not user: return True if user.name == self.username.data: self.username.errors.append(ERROR_USERNAME_EXISTS) if user.email == self.email.data: self.email.errors.append(ERROR_EMAIL_EXISTS) return False
class FeedbackForm(FlaskForm): option = SelectField( "Vyberte typ reakce", choices=[ ("bug", "Chyba v programu"), ("ux", "Problém s používáním uživatelského rozhraní"), ("suggestion", "Doporučení na zlepšení aplikace"), ("other", "Jiné"), ], ) message = StringField("Popište", [validators.InputRequired("Musí být vyplněno")]) email = EmailField("Váš email (pro případ nutnosti upřesnění)") feedback_file = FileField("Screenshot s problémem") submit = SubmitField("Poslat reakci")
class LoginForm(FlaskForm): email = EmailField(label='Email address', validators=[DataRequired()]) password = PasswordField(label='Password', validators=[DataRequired()]) remember = BooleanField(label='Remember me') def validate_email(self, email): user = User.query.filter_by(email=email.data).first() if user is None: raise ValidationError('No account found with that email address.') def validate_password(self, password): user = User.query.filter_by(email=self.email.data).first() if user is None: raise ValidationError('No account found with that email address.') if not user.check_password(password.data): raise ValidationError('Incorrect password.')
class RegisterForm(FlaskForm): """Form for registering a user.""" username = StringField("Username", validators=[InputRequired(), Length(max=20)]) password = PasswordField("Password", validators=[InputRequired(), Length(min=6)]) email = EmailField("Email", validators=[InputRequired()]) first_name = StringField("First Name", validators=[InputRequired(), Length(max=30)]) last_name = StringField("Last Name", validators=[InputRequired(), Length(max=30)])
class UserForm(SanicForm): """User create form.""" name = StringField( "Name", validators=[ DataRequired(), Regexp("^[a-zA-Z]+$", message="Only letters allowed!"), ], ) email = EmailField( "E-mail", validators=[ DataRequired(), Email(message="Please enter a valid email address!"), ], ) phone = TelField( "Phone", validators=[ Optional(), Regexp( "^\\+?[0-9]{3}-?[0-9]{6,12}$", message="Please enter a valid phone number!", ), ], ) mobile = TelField( "Mobile phone", validators=[ Optional(), Regexp( "^\\+?[0-9]{3}-?[0-9]{6,12}$", message="Please enter a valid mobile number!", ), ], ) status = SelectField("Status", choices=[(s.name, s.value) for s in Status]) async def save(self, conn, user=None) -> None: await conn.execute( insert(User), { key: getattr(self, key).data for key in self._fields if hasattr(User, key) }, )
class LdapForm(Form): uid = StringField( 'Username', validators=[ validators.Length( min=2, max=25, message="Username length is baad. min: 2, max: 25"), validators.DataRequired(message="Username is required") ]) sammyNick = StringField( 'BananaNick', validators=[ validators.Length(min=2, max=25, message="BananaNick is baad. min: 2, max: 25"), validators.DataRequired(message="BanaNick is required!") ]) drink_notification = SelectField('Drink Notification', default='instant', choices=[ ("instant", "instant"), ("daily", "daily"), ("instant and daily", "instant and daily"), ("weekly", "weekly"), ("instant and weekly", "instant and weekly"), ("never", "never"), ]) hue = IntegerField("Hue", default=0, validators=[validators.NumberRange(min=0, max=360)]) oldPassword = PasswordField('Old password') password = PasswordField( 'New password', [validators.EqualTo('confirm', message='Passwords must match')]) confirm = PasswordField('Repeat new password') mail = EmailField( "Email", validators=[validators.Email(message="Email is invalid!")]) sshKeys = FieldList(FormField(ListSSHForm)) macs = FieldList(FormField(ListMacForm))
class EventPrivacyForm(IndicoForm): _data_controller_fields = ('data_controller_name', 'data_controller_email') _privacy_policy_fields = ('privacy_policy_urls', 'privacy_policy') data_controller_name = StringField(_('Person/Institution')) data_controller_email = EmailField(_('Contact email'), [Optional(), Email()]) privacy_policy_urls = IndicoLinkListField( _('External page'), description=_('List of URLs to external pages containing privacy ' 'notices.')) privacy_policy = TextAreaField( _('Text'), widget=CKEditorWidget(), description=_('Only used if no URL is provided')) def validate_privacy_policy(self, field): if self.privacy_policy_urls.data and self.privacy_policy.data: raise ValidationError( _('Define either a privacy notice text or URLs'))
class RegistrationForm(FlaskForm): username = StringField('Username', validators=[DataRequired(), Length(min=5, max=20)]) email = EmailField('Email', validators=[DataRequired(), Email()]) password = PasswordField('Password', validators=[DataRequired(), Length(min=8)]) confirm_password = PasswordField('Confirm Password', validators=[DataRequired(), Length(min=8), EqualTo('password')]) phone = TelField('Phone', validators=[DataRequired()]) first_name = StringField('First Name', validators=[DataRequired(), Length(min=2, max=20)]) last_name = StringField('Last Name', validators=[Length(max=20)]) address = TextAreaField('Address') submit = SubmitField('Sign Up') def validate_username(self, username): user = User.query.filter_by(username=username.data).first() if user: raise ValidationError('This username is already taken. Please choose another one.') def validate_email(self, email): parent = Parent.query.filter_by(email=email.data).first() if parent: raise ValidationError('This email is already registered with an account. Please go to login')
class UpdateParentAccountForm(FlaskForm): picture = FileField('Update Profile Picture', validators=[FileAllowed(['jpg', 'png'])]) username = StringField('Username', validators=[DataRequired(), Length(min=5, max=20)]) email = EmailField('Email', validators=[DataRequired(), Email()]) phone = TelField('Phone', validators=[DataRequired()]) address = TextAreaField('Address') submit = SubmitField('Update') def validate_username(self, username): if username.data != current_user.username: user = User.query.filter_by(username=username.data).first() if user: raise ValidationError('That username is taken. Please choose a different one.') def validate_email(self, email): parent = Parent.query.filter_by(id=current_user.id).first() if email.data != parent.email: user = Parent.query.filter_by(email=email.data).first() if user: raise ValidationError('That email is taken. Please choose a different one.')
class RegisterForm(FlaskForm): username = StringField( 'Username', validators=[DataRequired('A username must be entered')]) password = PasswordField( 'Password', validators=[DataRequired("Please enter a password.")]) first_name = StringField( 'First Name', validators=[DataRequired('First name field should not be empty ')]) last_name = StringField( 'Password', validators=[DataRequired('Last Name field should not be empty')]) email = EmailField( 'Email', validators=[DataRequired('Email Field should not be empty')]) Location = StringField( 'Location', validators=[DataRequired('No location was provided')]) Biography = TextAreaField('Biography', validators=[DataRequired('Enter a Biography ')]) photo = FileField('photo', validators=[ FileRequired('No photo was submitted.'), FileAllowed(['jpg', 'jpeg', 'png'], 'Images only!') ])
class user(Form): nome = StringField('Nome', [ validators.length(min=2, max=10, message='Nome invalido min 2 max 10') ]) email = EmailField( 'Email', [validators.length(min=2, max=20, message='Email invalido')])
class RegisterCustomerForm(FlaskForm): first_name = StringField( "Vorname", validators=[ DataRequired("Dieses Feld wird benötigt"), Length( min=1, max=255, message="Der Name muss zwischen 1 und 255 Zeichen lang sein") ]) last_name = StringField( "Nachname", validators=[ DataRequired("Dieses Feld wird benötigt"), Length( min=1, max=255, message="Der Name muss zwischen 1 und 255 Zeichen lang sein") ]) street = StringField( "Straße", validators=[ DataRequired("Dieses Feld wird benötigt"), Length( min=1, max=255, message="Die Straße muss zwischen 1 und 255 Zeichen lang sein") ]) zip_code = StringField( "PLZ", validators=[ DataRequired("Dieses Feld wird benötigt"), Length(min=3, max=10, message="Die PLZ muss zwischen 3 und 10 Zeichen lang sein") ]) city = StringField( "Stadt", validators=[ DataRequired("Dieses Feld wird benötigt"), Length( min=1, max=255, message="Die Stadt muss zwischen 1 und 255 Zeichen lang sein") ]) email = EmailField( "Email", validators=[ DataRequired("Dieses Feld wird benötigt"), Email(message="Bitte gib eine gültige Email Adresse an"), Length( min=1, max=64, message="Die Email muss zwischen 1 und 255 Zeichen lang sein") ]) tel = StringField( "Telefon", validators=[ Length( min=0, max=64, message="Die Nummer muss zwischen 3 und 64 Zeichen lang sein") ]) tricoma_id = StringField( "Kundennummer", validators=[ Length( min=0, max=64, message="Die Nummer muss zwischen 1 und 64 Zeichen lang sein") ])
class LoginForm(FlaskForm): email = EmailField('Почта', validators=[DataRequired()]) password = PasswordField('Пароль', validators=[DataRequired()]) remember_me = BooleanField('Запомнить меня') submit = SubmitField('Войти')