]>
Commit | Line | Data |
---|---|---|
e5424f29 MR |
1 | from flask_wtf import FlaskForm |
2 | from wtforms import StringField, PasswordField, SubmitField, BooleanField, IntegerField | |
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 | login = SubmitField('Sign in') | |
9 | ||
10 | class RegisterForm(FlaskForm): | |
11 | name = StringField('Name', validators=[InputRequired()]) | |
12 | email = StringField('Email', validators=[InputRequired(), Email(message='Invalid email'), Length(max=80)]) | |
13 | username = StringField('Username', validators=[InputRequired(), Length(min=3, max=15)]) | |
14 | password = PasswordField('Password', validators=[InputRequired(), Length(min=8, max=80)]) | |
15 | passwordchk = PasswordField('Repeat password', validators=[InputRequired(), Length(min=8, max=80)]) | |
16 | register = SubmitField('Register') | |
17 | ||
18 | class UpdateForm(FlaskForm): | |
19 | name = StringField('Name', validators=[InputRequired()]) | |
20 | email = StringField('Email', validators=[InputRequired(), Email(message='Invalid email'), Length(max=80)]) | |
21 | username = StringField('Username', validators=[InputRequired(), Length(min=3, max=15)]) | |
22 | update = SubmitField('Update') | |
23 | ||
24 | class PwForm(FlaskForm): | |
25 | password = PasswordField('New password', validators=[InputRequired(), Length(min=8, max=80)]) | |
26 | passwordchk = PasswordField('Repeat password', validators=[InputRequired(), Length(min=8, max=80)]) | |
27 | passwordcur = PasswordField('Current password', validators=[InputRequired(), Length(min=8, max=80)]) | |
28 | pwchange = SubmitField('Change Password') | |
29 | ||
30 | class SearchForm(FlaskForm): | |
31 | token = StringField('Search') | |
32 | search = SubmitField('Submit') | |
33 | ||
34 | class DeleteForm(FlaskForm): | |
35 | delete = SubmitField('Submit') | |
36 | ||
37 | class AlbumForm(FlaskForm): | |
38 | name = StringField('Name', validators=[InputRequired()]) | |
39 | visible = BooleanField('Visible') | |
40 | public = BooleanField('Public') | |
41 | portfolio_id = IntegerField('Portfolio') | |
42 | album = SubmitField('Create') | |
43 | ||
44 | class PortfolioForm(FlaskForm): | |
45 | name = StringField('Name', validators=[InputRequired()]) | |
46 | visible = BooleanField('Visible') | |
47 | public = BooleanField('Public') | |
48 | portfolio = SubmitField('Create') |