Ejemplo n.º 1
0
class RegisterForm(Form):
    fullname = TextField('Full name', [
        validators.Length(
            min=3,
            max=35,
            message="Full name must be between 3 and 35 characters long")
    ])
    username = TextField('User name', [
        validators.Length(
            min=3,
            max=35,
            message="User name must be between 3 and 35 characters long"),
        Unique(model.Session,
               model.User,
               model.User.name,
               message="The user name is already taken")
    ])
    email_addr = TextField('Email Address', [
        validators.Length(
            min=3,
            max=35,
            message="Email must be between 3 and 35 characters long"),
        validators.Email(),
        Unique(model.Session,
               model.User,
               model.User.email_addr,
               message="Email is already taken")
    ])
    password = PasswordField('New Password', [
        validators.Required(message="Password cannot be empty"),
        validators.EqualTo('confirm', message='Passwords must match')
    ])
    confirm = PasswordField('Repeat Password')
Ejemplo n.º 2
0
class UpdateProfileForm(Form):
    id = IntegerField(label=None, widget=HiddenInput())
    fullname = TextField('Full name', [
        validators.Length(
            min=3,
            max=35,
            message="Full name must be between 3 and 35 characters long")
    ])
    name = TextField('User name', [
        validators.Length(
            min=3,
            max=35,
            message="User name must be between 3 and 35 characters long"),
        Unique(model.Session,
               model.User,
               model.User.name,
               message="The user name is already taken")
    ])
    email_addr = TextField('Email Address', [
        validators.Length(
            min=3,
            max=35,
            message="Email must be between 3 and 35 characters long"),
        validators.Email(),
        Unique(model.Session,
               model.User,
               model.User.email_addr,
               message="Email is already taken")
    ])
Ejemplo n.º 3
0
class FormClient(wtf.Form):
    name = wtf.StringField(
        label='Nom du Client :',
        validators=[validators.Required('Champ Obligatoire')])
    ref = wtf.StringField(label='Ref :',
                          validators=[
                              validators.Required('Champ Obligatoire'),
                              unique_reference
                          ])
    bp = wtf.StringField(label='Boite Postal :',
                         validators=[validators.Required('Champ Obligatoire')])
    adresse = wtf.TextAreaField(
        label='Adresse :',
        validators=[validators.Required('Champ Obligatoire')])
    ville = wtf.StringField(
        label='Ville :', validators=[validators.Required('Champ Obligatoire')])
    pays = wtf.StringField(
        label='Pays :', validators=[validators.Required('Champ Obligatoire')])
    email = wtf.StringField(label='Email :',
                            validators=[
                                validators.Required('Champ Obligatoire'),
                                unique_email_validator,
                                validators.Email('Email invalide')
                            ])
    phone = wtf.StringField(
        label='Telephone :',
        validators=[validators.Required('Champ Obligatoire')])
    id = wtf.HiddenField()
Ejemplo n.º 4
0
class RegisterForm(Form):
    err_msg = lazy_gettext(
        "Full name must be between 3 and 35 characters long")
    fullname = TextField(lazy_gettext('Full name'),
                         [validators.Length(min=3, max=35, message=err_msg)])

    err_msg = lazy_gettext(
        "User name must be between 3 and 35 characters long")
    err_msg_2 = lazy_gettext("The user name is already taken")
    username = TextField(lazy_gettext('User name'), [
        validators.Length(min=3, max=35, message=err_msg),
        pb_validator.NotAllowedChars(),
        pb_validator.Unique(db.session, model.User, model.User.name, err_msg_2)
    ])

    err_msg = lazy_gettext("Email must be between 3 and 35 characters long")
    err_msg_2 = lazy_gettext("Email is already taken")
    email_addr = TextField(lazy_gettext('Email Address'), [
        validators.Length(min=3, max=35, message=err_msg),
        validators.Email(),
        pb_validator.Unique(db.session, model.User, model.User.email_addr,
                            err_msg_2)
    ])

    err_msg = lazy_gettext("Password cannot be empty")
    err_msg_2 = lazy_gettext("Passwords must match")
    password = PasswordField(lazy_gettext('New Password'), [
        validators.Required(err_msg),
        validators.EqualTo('confirm', err_msg_2)
    ])

    confirm = PasswordField(lazy_gettext('Repeat Password'))
Ejemplo n.º 5
0
 def validate(form, field):
     if field.data == '':
         return
     if '@' not in field.data:
         raise ValidationError("Invalid e-mail address.")
     v = validators.Email()
     v(form, field)
Ejemplo n.º 6
0
class MainUpdateUserForm(wtf.Form):
    fname = wtf.TextField('First Name*', [validators.Required()])
    mname = wtf.TextField('Middle Name', [validators.Optional()])
    lname = wtf.TextField('Last Name*', [validators.Required()])
    avatar = wtf.TextField(
        'Gravatar Email',
        [validators.Optional(), validators.Email()])
Ejemplo n.º 7
0
class RegistrationForm(Form):
    username = TextField('Username', [
        validators.Required(),
        validators.Length(
            min=3, max=30, message='Username must be %(min)d - %(max)d chars'),
        validators.Regexp(
            '^[A-Za-z0-9\-_]+$',
            message=
            'Username may only contain letters, numbers, dashes and underscores'
        )
    ])
    email = TextField('Email', [
        validators.Required(),
        validators.Email(),
        validators.Length(max=255)
    ])
    password = PasswordField('Password', [
        validators.Required(),
        validators.EqualTo('password_confirm',
                           message='Passwords did not match')
    ])
    password_confirm = PasswordField('Confirm Password')
    submit = SubmitField('Register')

    def validate_username(form, field):
        user = models.User.query.filter_by(username=field.data).all()
        if user:
            raise ValidationError, 'Username already exists'
Ejemplo n.º 8
0
class ForgotPasswordForm(Form):

    """Form Class for forgotten password."""

    err_msg = lazy_gettext("Email must be between 3 and 35 characters long")
    email_addr = TextField(lazy_gettext('Email Address'),
                           [validators.Length(min=3, max=35, message=err_msg),
                            validators.Email()])
Ejemplo n.º 9
0
class NewStudentForm(wtf.Form):
    name = wtf.TextField('Name', validators=[validators.Optional()])
    email = wtf.TextField(
        'Email', validators=[validators.Required(),
                             validators.Email()])
    graduation_year = wtf.TextField('Graduation year',
                                    validators=[validators.Optional()])
    preferences = MultiCheckboxField('Preferences',
                                     choices=zip(models.SUBJECTS,
                                                 models.SUBJECTS),
                                     validators=[validators.Optional()])
Ejemplo n.º 10
0
class EditUserForm(Form):
    email = TextField("email", [
        validators.Length(min=6, max=35),
        validators.Email(message="Not a valid email address"),
        Unique(User, User.email)
    ])
    password = PasswordField("New password", [
        validators.Required(),
        validators.EqualTo("confirm", message="Passwords must match")
    ])
    confirm = PasswordField("Confirm new password")
Ejemplo n.º 11
0
class FormLogin(wtf.Form):
    email = wtf.StringField(label='Adresse Email',
                            validators=[
                                validators.Email('Adresse Email invalide'),
                                validators.Required('Information obligatoire')
                            ])
    password = wtf.PasswordField(
        label='Mot de passe',
        validators=[
            validators.Required('Information obligatoire'), password_validator
        ])
Ejemplo n.º 12
0
class ContactForm(Form):
    name = TextField("Name", [validators.Required("Please, enter your name.")])
    email = TextField("Email", [
        validators.Required("Please enter your email address."),
        validators.Email("Please enter valid email address.")
    ])
    subject = TextField("Subject",
                        [validators.Required("Please enter a subject.")])
    message = TextAreaField("Message",
                            [validators.Required("Please enter a message.")])
    submit = SubmitField("Send")
Ejemplo n.º 13
0
class RegistrationForm(Form):
    email = TextField("email",
                      [validators.Email(message="Not a valid email address")])
    username = TextField(
        "username", [validators.Length(min=6),
                     Unique(User, User.username)])
    password = PasswordField("Password", [
        validators.Required(),
        validators.EqualTo("Confirm", message="Passwords must match")
    ])
    confirm = PasswordField("Repeat Password")
    recaptcha = RecaptchaField()
Ejemplo n.º 14
0
class CreateUserForm(wtf.Form):
    fname = wtf.TextField('First Name*', [validators.Required()])
    mname = wtf.TextField('Middle Name', [validators.Optional()])
    lname = wtf.TextField('Last Name*', [validators.Required()])
    cwruid = wtf.TextField('CWRU ID*', [validators.Required()])
    family = wtf.SelectField('Family', [validators.Optional()])
    big = wtf.TextField('Big CWRU ID', [validators.Optional()])
    avatar = wtf.TextField(
        'Gravatar email',
        [validators.Email(), validators.Optional()])
    # need to make the role list change according to the roles in the database
    roles = wtf.SelectMultipleField('Role Name', [validators.Optional()])
Ejemplo n.º 15
0
class FormMag(wtf.Form):
    id = wtf.HiddenField()

    name = wtf.StringField(label='Point de vente :', validators=[validators.Required('Nom du magasin obligatoire'), unique_name_validator])
    biographic = wtf.TextAreaField(label='Bio du point de vente :')

    adresse = wtf.StringField(label='Adresse :')
    ville = wtf.StringField(label='Ville :')

    phone = wtf.StringField(label='Telephone :')
    email = wtf.StringField(label='Adresse Email :', validators=[validators.Required('Adresse courriel obligatoire'),
                                                                 validators.Email('Adresse email invalide')
                                                                 ])
Ejemplo n.º 16
0
class UserSettingsForm(Form):
    password = PasswordField('Current Password', [validators.Required()])
    email = TextField('Email', [
        validators.Required(),
        validators.Email(),
        validators.Length(max=255)
    ])
    new_password = PasswordField('New Password', [
        validators.Optional(),
        validators.EqualTo('new_password_confirm',
                           message='New passwords did not match')
    ])
    new_password_confirm = PasswordField('Confirm New Password')
    submit = SubmitField('Change Settings')
Ejemplo n.º 17
0
class FormUser(wtf.Form):
    id = wtf.HiddenField()
    first_name = wtf.StringField(
        label='Nom',
        validators=[validators.Required('Information obligatoire')])
    last_name = wtf.StringField(label='Prenom')
    email = wtf.StringField(label='Adresse Email',
                            validators=[
                                validators.Email('Adresse email invalide'),
                                validators.Required('Information obligatoire'),
                                unique_email_validator_2
                            ])
    phone = wtf.StringField(label='Telephone')
    appareil = wtf.SelectMultipleField(label='Appareil', coerce=str)
    categorie = wtf.SelectMultipleField(label='Departement', coerce=str)
Ejemplo n.º 18
0
class FormCompany(wtf.Form):
    name = wtf.StringField(
        label='Nom de la societe :',
        validators=[validators.Required(message='Champs Obligatoire')])
    bp = wtf.StringField(label='Boite Postal :')
    adress = wtf.StringField(
        label='Adresse :',
        validators=[validators.Required(message='Champs Obligatoire')])
    ville = wtf.StringField(
        label='Ville :',
        validators=[validators.Required(message='Champs Obligatoire')])
    pays = wtf.StringField(label='Pays :')
    phone = wtf.StringField(
        label='Numero Telephone :',
        validators=[validators.Required(message='Champs Obligatoire')])
    capital = wtf.StringField(label='Capital social :')
    numcontr = wtf.StringField(
        label='Numero du contribuable',
        validators=[validators.Required(message='Champs Obligatoire')])
    registcom = wtf.StringField(
        label='Registre du commerce',
        validators=[validators.Required(message='Champs Obligatoire')])
    email = wtf.StringField(
        label='Adresse mail',
        validators=[
            validators.Required(message='Champs Obligatoire'),
            validators.Email('Email invalide')
        ])
    siteweb = wtf.StringField(
        label='Site Web',
        validators=[validators.Required(message='Champs Obligatoire')])
    slogan = wtf.StringField(label='Slogan/Breve description :')
    typEnt = wtf.StringField(
        label='Selectionnez le type :',
        validators=[validators.Required(message='Champs Obligatoire')])
    facebook = wtf.StringField(
        label='Lien facebook :',
        validators=[validators.Required(message='Champs Obligatoire')])
    twitter = wtf.StringField(
        label='Lien twitter :',
        validators=[validators.Required(message='Champs Obligatoire')])
    quartier = wtf.StringField(
        label='Quartier :',
        validators=[validators.Required(message='Champs Obligatoire')])
    emailNotification = wtf.StringField(label='Email Notification :')
    senderNotification = wtf.StringField(label='Sender Notification :')
Ejemplo n.º 19
0
class FormCompte(wtf.Form):
    id = wtf.HiddenField()
    nameCompagny = wtf.StringField(label='Nom Entreprise :', validators=[validators.Required('Nom de l\'entreprise obligatoire')])
    notification_email = wtf.StringField(label='Adresse Email :', validators=[validators.Required('Information obligatoire'),
                                                                 validators.Email('Adresse email invalide'),
                                                                 unique_email_validator])
    phone = wtf.StringField(label='Telephone :', validators=[validators.Required('Information du telephone obligatoire')])
    pays = wtf.StringField(label='Pays :', validators=[validators.Required('Information du pays obligatoire')])
    ville = wtf.StringField(label='Ville :', validators=[validators.Required('Information de la ville obligatoire')])
    adresse_un = wtf.StringField(label='Adresse 1 :')
    adresse_deux = wtf.StringField(label='Adresse 2 :')

    siteweb = wtf.StringField(label='Site Web :')
    facebook_link = wtf.StringField(label='Lien Facebook :')
    twitter_link = wtf.StringField(label='Lien twitter :')
    instagramm = wtf.StringField(label='Lien instagramm :')
    devise = wtf.StringField(label='Devise :')
Ejemplo n.º 20
0
class FormContact(wtf.Form):
    first_name = wtf.StringField(
        label='Nom du contact :',
        validators=[validators.Required('Champ Obligatoire')])
    last_name = wtf.StringField(
        label='Prenon du contact :',
        validators=[validators.Required('Champ Obligatoire')])
    email = wtf.StringField(label='Adresse Email',
                            validators=[
                                validators.Required('Champ Obligatoire'),
                                validators.Email('Email invalide')
                            ])
    phone1 = wtf.StringField(label='Telephone mobile :', validators=[numeric])
    phone2 = wtf.StringField(label='Telephone fixe :', validators=[numeric])
    client_id = wtf.SelectField(label='Client du contact :',
                                coerce=str,
                                validators=[client_id_required])
    contact = wtf.HiddenField(default=None)
Ejemplo n.º 21
0
class FormUser(wtf.Form):
    id = wtf.HiddenField()
    user = wtf.HiddenField()
    first_name = wtf.StringField(
        label='Prenom',
        validators=[validators.Required('Information obligatoire')])
    last_name = wtf.StringField(
        label='Nom',
        validators=[validators.Required('Information obligatoire')])
    email = wtf.StringField(label='Adresse Email',
                            validators=[
                                validators.Email('Email non valid'),
                                validators.Required('Information obligatoire'),
                                unique_email_validator
                            ])
    fonction = wtf.StringField(label='Fonction :')
    phone = wtf.StringField(label='Telephone Mobile :')
    note = wtf.TextAreaField(label='Note interne :')
Ejemplo n.º 22
0
class RegistrationForm(LoginForm):
    email = EmailField('Email Address', [
        validators.Required(),
        validators.Length(min=6, max=64),
        validators.Email(u'Invalid Email Address')
    ])
    name = TextField('Full Name (Optional)', [
        validators.Optional(),
        validators.Length(min=2, max=64)])
    phone = TextField('Phone Number', [
        validators.Optional(),
        validators.Length(min=5, max=20)])
    password = PasswordField('New Password', [
        validators.Required(),
        validators.EqualTo('confirm', message='Passwords must match')
        ])
    confirm = PasswordField('Repeat Password')
    admin = BooleanField('Make me an Admin')
Ejemplo n.º 23
0
class UpdateProfileForm(Form):

    """Form Class for updating PyBossa's user Profile."""

    id = IntegerField(label=None, widget=HiddenInput())

    err_msg = lazy_gettext("Full name must be between 3 and 35 "
                           "characters long")
    fullname = TextField(lazy_gettext('Full name'),
                         [validators.Length(min=3, max=35, message=err_msg)])

    err_msg = lazy_gettext("User name must be between 3 and 35 "
                           "characters long")
    err_msg_2 = lazy_gettext("The user name is already taken")
    name = TextField(lazy_gettext('User name'),
                     [validators.Length(min=3, max=35, message=err_msg),
                      pb_validator.NotAllowedChars(),
                      pb_validator.Unique(
                          db.session, model.User, model.User.name, err_msg_2)])

    err_msg = lazy_gettext("Email must be between 3 and 35 characters long")
    err_msg_2 = lazy_gettext("Email is already taken")
    email_addr = TextField(lazy_gettext('Email Address'),
                           [validators.Length(min=3, max=35, message=err_msg),
                            validators.Email(),
                            pb_validator.Unique(
                                db.session, model.User,
                                model.User.email_addr, err_msg_2)])

    locale = SelectField(lazy_gettext('Default Language'))
    ckan_api = TextField(lazy_gettext('CKAN API Key'))

    def set_locales(self, locales):
        """Fill the locale.choices."""
        choices = []
        for locale in locales:
            if locale == 'en':
                lang = gettext("English")
            if locale == 'es':
                lang = gettext("Spanish")
            if locale == 'fr':
                lang = gettext("French")
            choices.append((locale, lang))
        self.locale.choices = choices
Ejemplo n.º 24
0
class SignupForm(Form):
    username = f.TextField('Username', [
        v.Length(min=3, max=128),
        v.Regexp(r'^[^@]*$', message="Username shouldn't be an email address")
    ])
    email = html5.EmailField('Email address', [
        v.Length(min=3, max=128),
        v.Email(message="This should be a valid email address.")
    ])
    password = f.PasswordField('Password', [
        v.Required(),
        v.Length(
            min=8,
            message=
            "It's probably best if your password is longer than 8 characters."
        ),
        v.EqualTo('confirm', message="Passwords must match.")
    ])
    confirm = f.PasswordField('Confirm password')

    # Will only work if set up in config (see http://packages.python.org/Flask-WTF/)
    captcha = f.RecaptchaField('Captcha')
Ejemplo n.º 25
0
class FormRegister(wtf.Form):
    id = wtf.HiddenField()
    name = wtf.StringField(
        label='Nom Entreprise',
        validators=[validators.Required('Nom de l\'entreprise obligatoire')])
    email = wtf.StringField(label='Adresse Email',
                            validators=[
                                validators.Required('Information obligatoire'),
                                validators.Email('Adresse email invalide'),
                                unique_email_validator
                            ])

    password = wtf.PasswordField(
        label='Mot de passe',
        validators=[
            validators.Required('Mot de passe obligatoire'), password_validator
        ])
    retype_password = wtf.PasswordField(
        label='Confirmation du mot de passe',
        validators=[
            validators.EqualTo(
                'password', message='Les deux mots de passe sont differents')
        ])

    phone = wtf.StringField(
        label='Telephone',
        validators=[
            validators.Required('Information du telephone obligatoire')
        ])
    pays = wtf.StringField(
        label='Pays',
        validators=[validators.Required('Information du pays obligatoire')])
    ville = wtf.StringField(
        label='Ville',
        validators=[
            validators.Required('Information de la ville obligatoire')
        ])
    adresse_un = wtf.StringField(label='Adresse 1')
    adresse_deux = wtf.StringField(label='Adresse 2')
Ejemplo n.º 26
0
class FormRegisterUserAdmin(wtf.Form):
    first_name = wtf.StringField(
        label='Prenom',
        validators=[validators.Required('Information obligatoire')])
    last_name = wtf.StringField(
        label='Nom',
        validators=[validators.Required('Information obligatoire')])
    email = wtf.StringField(label='Adresse Email',
                            validators=[
                                validators.Email('Email non valid'),
                                validators.Required('Information obligatoire'),
                                unique_email_validator
                            ])
    password = wtf.PasswordField(
        label='Mot de passe',
        validators=[
            validators.Required('Information obligatoire'), password_validator
        ])
    retype_password = wtf.PasswordField(
        label='Confirmation du mot de passe',
        validators=[
            validators.EqualTo(
                'password', message='Les deux mots de passe sont differents')
        ])
Ejemplo n.º 27
0
class EmailAddressForm(wtf.Form):
    emailName = wtf.TextField('Name', [validators.Optional()])
    emailAddress = wtf.TextField(
        'Email',
        [validators.Required(), validators.Email()])
    key = wtf.HiddenField([validators.Optional()])
Ejemplo n.º 28
0
class ContactForm(wtf.Form):
    email = wtf.StringField('Votre e-mail',
                            validators=[validators.Email()])
    message = wtf.TextAreaField(u"Le message à envoyer à l'AFCP :",
                                validators=[validators.InputRequired()])
Ejemplo n.º 29
0
class ForgotPasswordForm(Form):
    email_addr = TextField('Email Address',
            [validators.Length(min=3, max=35,
                message="Email must be between 3 and 35 characters long"),
                validators.Email(),
            ])