-
Notifications
You must be signed in to change notification settings - Fork 2
/
forms.py
25 lines (20 loc) · 1.3 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from wtforms import Form, StringField, PasswordField, validators, SubmitField
from wtforms.validators import ValidationError, DataRequired, Email, EqualTo, Length, Optional
class SignupForm(Form):
"""User Signup Form."""
name = StringField('Name',
validators=[DataRequired(message=('Enter a fake name or something.'))])
email = StringField('Email',
validators=[Length(min=6, message=('Please enter a valid email address.')),
Email(message=('Please enter a valid email address.')),
DataRequired(message=('Please enter a valid email address.'))])
password = PasswordField('Password',
validators=[DataRequired(message='Please enter a password.'),
Length(min=6, message=('Please select a stronger password.'))])
submit = SubmitField('Register')
class LoginForm(Form):
"""User Login Form."""
email = StringField('Email', validators=[DataRequired('Please enter a valid email address.'),
Email('Please enter a valid email address.')])
password = PasswordField('Password', validators=[DataRequired('Uhh, your password tho?')])
submit = SubmitField('Log In')