forked from realpython/flask-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.py
More file actions
20 lines (11 loc) · 708 Bytes
/
forms.py
File metadata and controls
20 lines (11 loc) · 708 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from flask.ext.wtf import Form, TextField, PasswordField
from flask.ext.wtf import Required, EqualTo, validators, Length
# set your classes here
class RegisterForm(Form):
name = TextField('Username', validators = [Required(), Length(min=6, max=25)])
email = TextField('Email', validators = [Required(), Length(min=6, max=40)])
password = PasswordField('Password', validators = [Required(), Length(min=6, max=40)])
confirm = PasswordField('Repeat Password', [Required(), EqualTo('password', message='Passwords must match')])
class LoginForm(Form):
name = TextField('Username', [Required()])
passwd = PasswordField('Password', [Required()])