This repository has been archived by the owner on Oct 7, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.py
43 lines (33 loc) · 2.16 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from flask_wtf import FlaskForm
from wtforms import SubmitField, StringField, PasswordField, HiddenField, BooleanField, SelectField, \
SelectMultipleField, DateTimeField, IntegerField
from wtforms.validators import DataRequired, Length, EqualTo, InputRequired
class LoginForm(FlaskForm):
username = StringField("Username", validators=[DataRequired()])
password = PasswordField("Password", validators=[DataRequired()])
submit = SubmitField("Sign In")
class RegisterForm(FlaskForm):
username = StringField("Username", validators=[InputRequired(), Length(1, 64, message="Username must be between "
"1-64 characters in "
"length.")])
submit = SubmitField("Register")
class RegisterConfirmForm(FlaskForm):
req_id = HiddenField("Request",
validators=[DataRequired(), Length(64, 64, "Account request IDs must be 64 characters long.")])
password = PasswordField("Password", validators=[DataRequired(), Length(10, 72, message="Passwords must be "
"between 10 and 72 "
"characters long.")])
password_confirm = PasswordField("Confirm Password", validators=[DataRequired(),
EqualTo("password",
"Password and confirm password fields must"
" be the same.")])
submit = SubmitField("Confirm")
class RegisterConfirmCodeForm(FlaskForm):
req_id = StringField("Code", validators=[DataRequired(), Length(64, 64)])
submit = SubmitField("Confirm")
class SearchForm(FlaskForm):
username = StringField("Username")
forename = StringField("Forename")
surname = StringField("Surname")
class_id = SelectField("Classes")
submit = SubmitField("Submit")