]>
Commit | Line | Data |
---|---|---|
1 | from flask_wtf import FlaskForm | |
2 | from wtforms import StringField, PasswordField, BooleanField, SubmitField | |
3 | from wtforms.validators import InputRequired, Email, Length | |
4 | ||
5 | class LoginForm(FlaskForm): | |
6 | username = StringField('Username', validators=[InputRequired()]) | |
7 | password = PasswordField('Password', validators=[InputRequired()]) | |
8 | remember_me = BooleanField('Remember me', default=False) | |
9 | submit_btn = SubmitField('Sign in') | |
10 | ||
11 | class RegisterForm(FlaskForm): | |
12 | name = StringField('Name', validators=[InputRequired()]) | |
13 | email = StringField('Email', validators=[InputRequired(), Email(message='Invalid email'), Length(max=80)]) | |
14 | username = StringField('Username', validators=[InputRequired(), Length(min=3, max=15)]) | |
15 | password = PasswordField('Password', validators=[InputRequired(), Length(min=8, max=80)]) | |
16 | passwordchk = PasswordField('Repeat password', validators=[InputRequired(), Length(min=8, max=80)]) | |
17 | submit_btn = SubmitField('Register') |