-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.py
67 lines (38 loc) · 2.03 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
60
61
62
63
64
65
66
from flask_wtf import FlaskForm, RecaptchaField
from wtforms import *
from wtforms.validators import *
from cyber.models import User
class RegistrationForm(FlaskForm):
username = StringField('Username', validators=[DataRequired('Please enter your username'), Length(min=3, max=15)])
email = StringField('Email',
validators=[DataRequired(), Email()])
password = PasswordField('Password', validators=[DataRequired(),Regexp('^.{8,24}$',
message='Your password should be between 8 and 24 characters long.')])
confirm_password = PasswordField('Confirm Password',
validators=[DataRequired(), EqualTo('password', message='Passwords must match')])
submit = SubmitField('Register')
def validate_username(self, username):
user = User.query.filter_by(username=username.data).first()
if user:
raise ValidationError('Username already exist. Please choose a different one.')
def validate_email(self, email):
user = User.query.filter_by(email=email.data).first()
if user:
raise ValidationError('This email is already registered. Please choose a different one.')
class LoginForm(FlaskForm):
email = StringField('Email', validators=[DataRequired(), Email()])
password = PasswordField('Password', validators=[DataRequired()])
submit = SubmitField('Login')
class PasswordCracking1(FlaskForm):
username = StringField('Username', validators=[DataRequired()])
password = PasswordField('Password', validators=[DataRequired()])
submit = SubmitField('Login')
class InspectForm1(FlaskForm):
password = PasswordField('Password', validators=[DataRequired()])
submit = SubmitField('Submit')
class InspectForm2(FlaskForm):
password = PasswordField('Password', validators=[DataRequired()])
submit = SubmitField('Submit')
class BasicPassword(FlaskForm):
password = PasswordField('Password', validators=[DataRequired()])
submit = SubmitField('Submit')