Beispiel #1
0
class PostForm(Form):

    title = TextField('Title', [validators.Length(min=4, max=60)])
    author = TextField('Author', [validators.Length(min=4, max=25)])
    published = BooleanField('Publish')
    permalink = TextField('Permanent Link',
                          [validators.Length(min=10, max=60)])
Beispiel #2
0
class placeableUpgradeForm(Form):
    name = StringField('Type Name', [validators.Length(min=4, max=20)])
    description = TextAreaField('Describe the Intention of this upgrade',
                                [validators.Length(min=4, max=250)])
    #Upgrde type selectable
    upgrade_type = SelectField(u'Upgrade Type', coerce=unicode)
    del_entity = HiddenField('del_entity')
Beispiel #3
0
class QuestionForm(Form):
    """Form that receives questions from users to the "Answer" tool"""

    theme = SelectField(
        _('Theme'),
        [
            validators.Required(
                message=_(u'You need to choose one of the options above'))
        ],
    )

    title = TextField(
        _('Contribution title'),
        [
            validators.Length(min=5,
                              message=_(
                                  u'Your title is too short! It needs to have '
                                  u'at least 5 chars')),
            validators.Length(max=256,
                              message=_(
                                  u'Your title is too long! It needs to have '
                                  u'at most 256 chars'))
        ],
    )

    question = TextField(
        _('Content'),
        [
            validators.Length(
                min=5,
                message=_(u'Your contribution is too short! It needs to have '
                          u'at least 50 chars')),
        ],
    )
Beispiel #4
0
class RegistrationForm(Form):
    full_name = TextField(lazy_gettext('School name'),
                          [validators.Required(),
                           validators.Length(min=4)] +
                          forms.SCHOOL_FULL_NAME_VALIDATORS,
                          description=lazy_gettext('School name.'))
    short_name = TextField(
        lazy_gettext('Short name'),
        [validators.Required()] + forms.SCHOOL_SHORT_NAME_VALIDATORS,
        description=lazy_gettext(
            'Short name (lower case, all letters, dots and numbers).'))
    url = TextField(lazy_gettext('School URL'), [
        validators.Length(min=6, max=200),
        validators.URL(),
        validators.Required()
    ],
                    description=lazy_gettext('Address of your school.'))
    user_full_name = TextField(
        lazy_gettext('User name'),
        [validators.Required(),
         validators.Length(min=4)] + forms.USER_FULL_NAME_VALIDATORS,
        description=lazy_gettext('Your name and last name.'))
    user_login = TextField(lazy_gettext('Login'), [validators.Required()] +
                           forms.USER_LOGIN_DEFAULT_VALIDATORS,
                           description=lazy_gettext(
                               'Your new login (you can create more later).'))
    user_password = PasswordField(
        lazy_gettext('Password'),
        [validators.Required()] + forms.USER_PASSWORD_DEFAULT_VALIDATORS,
        description=lazy_gettext('Your access password.'))
Beispiel #5
0
class LoginForm(Form):
    email = TextField(
        'Email', validators=[validators.Required(),
                             validators.Length(min=1)])
    password = PasswordField(
        'Password',
        validators=[validators.Required(),
                    validators.Length(max=50)])
Beispiel #6
0
class ProfileForm(Form):
    next = HiddenField()
    name = TextField(_('Username'))
    email = TextField(_('email'), [validators.Email()])
    website = TextField(_('URL'), [validators.URL()])
    location = TextField(_('Location'), [validators.Length(max=100)])
    bio = TextAreaField(_('bio'), [validators.Length(max=200)])
    submit = SubmitField(_('Save'))
Beispiel #7
0
class LoginForm(Form):
    username = TextField('Username or Email',
                         [validators.Length(min=4, max=255)],
                         filters=[strip_filter])
    password = PasswordField('Password',
                             [validators.Length(min=1, max=255)],
                             filters=[strip_filter])
    remember_me = BooleanField('Remember me', default=False)
Beispiel #8
0
class RegistrationForm(Form):
    username = TextField('Username', [validators.Length(min=6, max=35)])
    email = TextField('Email Address', [validators.Length(min=6, max=35)])
    password = PasswordField('Password', [
        validators.Length(min=6, max=35),
        validators.Required(),
        validators.EqualTo('confirm', message='Passwords must match')
    ])
    confirm = PasswordField('Repeat Password')
Beispiel #9
0
class RegistrationForm(Form):
    name = fields.TextField(u'First & Last name', [validators.Length(min=5)],
                description=u'John Doe')
    email = fields.TextField(u'Email', [validators.Email()],
                description=u'*****@*****.**')
    position = fields.TextField(u'Job Position', [validators.Length(min=5)],
                description=u'Senior Software Developer')
    company = fields.TextField(u'Company', [validators.Length(min=2)],
                description=u'Top 10 leader')
Beispiel #10
0
class LoginForm(Form):
    username = TextField(
        'Username',
        validators=[validators.Required(),
                    validators.Length(min=3, max=8)])
    password = PasswordField(
        'Password',
        validators=[validators.Required(),
                    validators.Length(max=50)])
Beispiel #11
0
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()])
Beispiel #12
0
class BookmarkForm(Form):
    title = TextField('title', [validators.Length(min=0, max=255)],
                      filters=[strip_filter])
    url = TextField('url', [
        validators.Length(min=4, max=512),
        validators.URL(require_tld=False, message='Not a valid URL')
    ],
                    filters=[strip_filter])
    tags = TextField('tags', [validators.Length(min=0, max=255)],
                     filters=[strip_filter])
Beispiel #13
0
class RegisterForm(Form):
    w = TextField('Username', [validators.Length(min=3, max=25), existscheck])
    n = TextField('Email Address', [
        validators.Length(min=3, max=35),
        validators.Email(message='Must be a valid email address')
    ])
    s = PasswordField('Password', [
        validators.Required(),
        validators.EqualTo('c', message='Passwords must match')
    ])
    c = PasswordField('Repeat Password')
Beispiel #14
0
class RegisterForm(Form):
    email = TextField(
        'Email', validators=[validators.Required(),
                             validators.Length(min=1)])
    password = PasswordField(
        'Password',
        validators=[validators.Required(),
                    validators.Length(max=50)])
    name = TextField(
        'Name', validators=[validators.Required(),
                            validators.Length(min=3)])
Beispiel #15
0
class RegistrationForm(Form):
    username = TextField(u'Nazwa użytkownika',
                         [validators.Length(min=4, max=25)],
                         id="username")
    email = TextField(u'Adres email', [validators.Length(min=6, max=35)],
                      id="email")
    password = PasswordField(u'Nowe hasło', [
        validators.Required(),
        validators.EqualTo('confirm', message='Hasła muszą być takie same')
    ],
                             id="password")
    confirm = PasswordField(u'Powtórz hasło', id="confirm")
Beispiel #16
0
class UpdateProfileForm(Form):
    updatedProfileImage = FileField(
        "Photo Upload",
        validators=[
            file_allowed(
                images,
                message=
                "The file you selected does not appear to be an image, please try again or contact support"
            )
        ])
    location = TextField()
    slogan = TextField(validators=[
        validators.Length(
            min=0,
            max=140,
            message=
            "Please keep your slogan short, 140 characters or less, please.")
    ])
    description = TextField(validators=[
        validators.Length(
            min=0,
            max=400,
            message="Please limit your description to 400 characters")
    ])

    def __init__(self, *args, **kwargs):
        Form.__init__(self, *args, **kwargs)

    def hasImage(self):
        return self.updatedProfileImage.data != None

    def validate(self):
        rv = Form.validate(self)
        self.rv = rv
        if not rv:
            return False
        #TODO: this code is repeated, inheritance seemed to break the cleaner version though
        if len(self.slogan.data) and self.slogan.data != current_user.slogan:
            current_user.slogan = self.slogan.data
            flash("Your slogan has been updated", "message")
        if len(self.description.data
               ) and self.description.data != current_user.description:
            current_user.description = self.description.data
            flash("Your description has been updated", "message")
        if len(self.location.data
               ) and self.location.data != current_user.location:
            current_user.location = self.location.data
            flash("Your location has been updated", "message")

        db.session.commit()
        return True
Beispiel #17
0
class ContentCreate_Form(Form):
    next = HiddenField()
    tags_csv = HiddenField()
    title = TextField(
        "Title",
        validators=[validators.required(),
                    validators.Length(max=128)])
    teaser = TextAreaField(
        "Teaser",
        validators=[validators.required(),
                    validators.Length(max=200)])
    content = TextAreaField("Body", validators=[validators.Required()])
    #recaptcha = RecaptchaField()
    submit = SubmitField("Submit")
Beispiel #18
0
class UserRegisterForm(Form):
    username = TextField('username', [validators.Length(min=4, max=32)],
                         filters=[strip_filter])
    email = TextField('email', [
        validators.Length(min=4, max=320),
        validators.Email(message='Not a valid email address')
    ],
                      filters=[strip_filter])
    password = PasswordField('password', [
        validators.Length(min=6, max=64),
        validators.EqualTo('confirm', message='Passwords must match')
    ],
                             filters=[strip_filter])
    confirm = PasswordField('confirm', filters=[strip_filter])
Beispiel #19
0
class ResetForm(Form):
    password = PasswordField('Password',
                             validators=[
                                 validators.Required(),
                                 validators.Length(min=8, max=50),
                                 validators.CrackLib()
                             ])
    pw_confirm = PasswordField('Confirm Password',
                               validators=[
                                   validators.Required(),
                                   validators.Length(min=8, max=50),
                                   validators.EqualTo(
                                       'password',
                                       message='Passwords do not match.')
                               ])
Beispiel #20
0
class SpaceUrlForm(Form):
    url = TextField(
        lazy_gettext('Space URL'),
        [validators.Length(min=6, max=200),
         validators.URL()],
        description=lazy_gettext("Drop here the URL of the Space."),
        default="http://graasp.epfl.ch/#item=space_1234")
Beispiel #21
0
class ResetPasswordForm(Form):
    password = f.PasswordField('New 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')
Beispiel #22
0
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')
Beispiel #23
0
class LoginForm(Form):
    username = TextField(u'Nazwa użytkownika',
                         [validators.Length(min=4, max=25)],
                         id="username")
    password = PasswordField(u'Hasło', [
        validators.Required(),
    ],
                             id="password")
Beispiel #24
0
class UserForm(Form, wtforms.ext.i18n.form.Form):
    username = TextField(lazy_gettext('login.placeholder.username'), [
        validators.Length(min=2, max=25),
        validators.Regexp('^\w+$',
                          message=lazy_gettext('signup.error.alphanum'))
    ])
    password = PasswordField(lazy_gettext('login.placeholder.password'),
                             [validators.Required()])
Beispiel #25
0
class MarkForm(Form):
    referrer = HiddenField([validators.URL(require_tld=False)])
    title = TextField('Title',
                      [validators.Length(min=0, max=255)],
                      filters=[strip_filter])
    url = TextField('URL',
                    [validators.Length(min=4, max=512),
                     validators.URL(require_tld=False,
                                    message='Not a valid URL')],
                    filters=[strip_filter])
    type = RadioField('Type',
                      coerce=unicode,
                      choices=[('bookmark', 'Bookmark'), ('feed', 'Feed')],
                      default='bookmark')
    tags = TextField('Tags',
                     [validators.Length(min=0, max=255)],
                     filters=[strip_filter])
Beispiel #26
0
class SignupForm(Form):
    username = f.TextField('Username', [
        v.Length(min=3, max=128),
        v.Regexp(r'^[^@:]*$', message="Username shouldn't contain '@' or ':'")
    ])
    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')
Beispiel #27
0
class NewPassOnlyForm(Form):
    new_pass = PasswordField(
        'Password',
        validators=[
            validators.Length(
                min=8,
                max=50,
                message='Password length must be between 8 and 50'),
            validators.CrackLib()
        ])
Beispiel #28
0
class AddUserForm(Form):
    user = TextField(
        'user',
        validators=[validators.Required(),
                    validators.Length(min=3, max=64)])
    email = TextField('email',
                      validators=[validators.Required(),
                                  validators.Email()])
    password = PasswordField('password',
                             validators=[
                                 validators.Required(),
                                 validators.Length(min=3, max=64),
                                 validators.EqualTo(
                                     'confirm',
                                     'Both passwords must be equal.')
                             ])
    confirm = PasswordField('confirm')
    roles = MultiCheckboxField('roles',
                               validators=[validators.Required()],
                               coerce=int)
Beispiel #29
0
class EditUserForm(Form):
    id = HiddenInteger('id')
    user = TextField(
        'user',
        validators=[validators.Required(),
                    validators.Length(min=3, max=64)])
    email = TextField('email',
                      validators=[validators.Required(),
                                  validators.Email()])
    roles = MultiCheckboxField('roles',
                               validators=[validators.Required()],
                               coerce=int)
Beispiel #30
0
class RegistrationForm(Form):
    email = fields.TextField('Email Address',
        validators=[Required(), Email(), Regexp('[^@]+@[^@]+[fsu]+\.[edu]+')])
    consent = fields.BooleanField(validators=[Required()])
    password = fields.PasswordField('New Password', [
        validators.Required(), validators.Length(min=8, max=20),
        validators.EqualTo('confirm', message='Passwords must match')
    ])
    confirm = fields.PasswordField(validators=[Required()])

    def validate_email(self, field):
        if db.session.query(User).filter_by(email=self.email.data).count() > 0:
            raise validators.ValidationError('Duplicate email')