-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathforms.py
executable file
·59 lines (47 loc) · 4.09 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from flask_wtf import FlaskForm
from wtforms import (StringField, BooleanField, PasswordField)
from wtforms.validators import InputRequired, Email, DataRequired, EqualTo, Regexp, Optional
class SignupForm(FlaskForm):
email = StringField('Email', validators=[InputRequired(), Email(message='Please provide a valid email')])
phone_num = StringField('Phone Number', validators=[DataRequired(), Regexp("^[0-9]{6,16}", message='Please '
'provide a '
'valid phone '
'number (e.g. '
'921234567890)')])
password = PasswordField('New Password',
validators=[DataRequired(), Regexp("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}", message="Please follow the guidelines for a strong password")])
confirm_pass = PasswordField('Confirm Password', validators=[DataRequired(), EqualTo('password', message="Passwords "
"don't "
"match!")])
newsletter = BooleanField('Subscribe to our newsletter', default='checked')
discoverable = BooleanField('Do you want your profile to be discoverable?', default='checked')
lng = StringField('lng', default='')
lat = StringField('lat', default='')
class LoginForm(FlaskForm):
email = StringField('Email', validators=[InputRequired(), Email(message='Enter a valid email')])
password = PasswordField('Password',
validators=[DataRequired()])
next = StringField('next')
class UpdateForm(FlaskForm):
email = StringField('Email', validators=[Email(message='Please provide a valid email'), Optional()])
phone_num = StringField('Phone Number', validators=[Regexp("^[0-9]{6,16}", message='Please '
'provide a '
'valid phone '
'number (e.g. '
'921234567890)'), Optional()])
password = PasswordField('New Password',
validators=[Regexp("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}",
message="Please follow the guidelines for a strong password"), Optional()])
confirm_pass = PasswordField('Confirm Password',
validators=[EqualTo('password', message="Passwords "
"don't "
"match!")])
discoverable = BooleanField('Do you want your profile to be discoverable?')
class ForgotForm(FlaskForm):
email = StringField('Email', validators=[InputRequired(), Email(message='Enter a valid email')])
class PasswordResetForm(FlaskForm):
password = PasswordField('New Password',
validators=[DataRequired(), Regexp("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}", message="Please follow the guidelines for a strong password")])
confirm_pass = PasswordField('Confirm Password', validators=[DataRequired(), EqualTo('password', message="Passwords "
"don't "
"match!")])