Пример #1
0
class SetEmailAndPasswordForm(ResetPasswordForm):
    token = HiddenField()
    accepted_terms_of_service = BooleanField(
        [
            validators.Required(message=u'This field is required'),
        ]
    )
Пример #2
0
class ResendConfirmationForm(Form):
    name = name_field_not_required  # If the user's auth already has a fullname this won't appear.
    email = email_field
    accepted_terms_of_service = BooleanField([
        validators.Required(message=u'This field is required'),
    ],
                                             widget=CheckboxInput())
Пример #3
0
class ResendConfirmationForm(Form):
    email = email_field
    accepted_terms_of_service = BooleanField(
        [
            validators.Required(message=u'This field is required'),
        ],
        widget=CheckboxInput()
    )
Пример #4
0
class NewNodeForm(Form):
    title = TextField('Title', [
        validators.Required(message=u'Title is required'),
        validators.Length(min=1,
                          message=u'Title must contain at least 1 character.'),
        validators.Length(
            max=200, message=u'Title must contain fewer than 200 characters.')
    ])
    description = TextField('Description')
    category = TextField('Category')
    inherit_contributors = BooleanField('Inherit')
Пример #5
0
class NewNodeForm(Form):
    title = TextField('Title', [
        validators.Required(message=u'Title is required'),
        validators.Length(min=1,
                          message=u'Title must contain at least 1 character.'),
        validators.Length(
            max=200, message=u'Title must contain fewer than 200 characters.')
    ],
                      widget=BootstrapTextInput())
    description = TextAreaField('Description', widget=BootstrapTextArea())
    category = TextAreaField('Category', widget=BootstrapTextArea())
Пример #6
0
class MergeAccountForm(Form):
    merged_username = TextField("Duplicate User's Email Address", [
        validators.Required(message=u'Email address is required'),
        validators.Length(min=6, message=u'Email address is too short'),
        validators.Length(max=120, message=u'Email address is too long'),
        validators.Email(message=u'Email address is invalid'),
        NoHtmlCharacters(),
        EmailExists(),
    ],
                                filters=[lowerstripped],
                                widget=BootstrapTextInput())
    merged_password = PasswordField(
        "Duplicate User's Password",
        [validators.Required(message=u"Please enter the user's password")],
        filters=[stripped],
        widget=BootstrapPasswordInput())
    user_password = PasswordField("This Account's Password", [
        validators.Required(
            message=u"Please enter the password for this account")
    ],
                                  filters=[stripped],
                                  widget=BootstrapPasswordInput())
Пример #7
0
class ResetPasswordForm(Form):
    password = PasswordField('New Password', [
        validators.Required(message=u'Password is required'),
        validators.Length(min=8,
                          message=u'Password is too short. '
                          'Password should be at least 8 characters.'),
        validators.Length(max=255,
                          message=u'Password is too long. '
                          'Password should be at most 255 characters.'),
    ],
                             filters=[stripped],
                             widget=BootstrapPasswordInput())

    password2 = PasswordField(
        'Verify New Password',
        [validators.EqualTo('password', message='Passwords must match')],
        filters=[stripped],
        widget=BootstrapPasswordInput())
Пример #8
0
        self.message = message

    def __call__(self, form, field):
        if not auth.get_user(email=field.data):
            msg = self.message or language.EMAIL_NOT_FOUND.format(
                email=field.data)
            raise ValidationError(msg)


##### Custom fields #####

# The order fields are defined determines their order on the page.
name_field = TextField(
    'Full Name',
    [
        validators.Required(message=u'Full name is required'),
        NoHtmlCharacters(),
    ],
    filters=[stripped],
    widget=BootstrapTextInput(),
)

email_field = TextField('Email Address', [
    validators.Required(message=u'Email address is required'),
    validators.Length(min=6, message=u'Email address is too short'),
    validators.Length(max=120, message=u'Email address is too long'),
    validators.Email(message=u'Email address is invalid'),
    NoHtmlCharacters(),
],
                        filters=[lowerstripped],
                        widget=BootstrapTextInput())