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
26
27
28
|
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, BooleanField
from wtforms.validators import DataRequired, Length, EqualTo
class RegistrationForm(FlaskForm):
alias = StringField('Alias',
validators=[DataRequired(),
Length(min=2, max=20)])
password = PasswordField('Password', validators=[DataRequired()])
password_confirm = PasswordField(
'Confirm Password', validators=[DataRequired(),
EqualTo('password')])
submit = SubmitField('Create Alias')
class LoginForm(FlaskForm):
alias = StringField('Alias',
validators=[DataRequired(),
Length(min=2, max=20)])
password = PasswordField('Password', validators=[DataRequired()])
remember = BooleanField('Remember Alias')
submit = SubmitField('Login Alias')
class NewMessage(FlaskForm):
recipient = StringField('Recipient', validators=[DataRequired()])
message = StringField('message', validators=[DataRequired()])
|