Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
# forms.py
from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, SubmitField, TextAreaField
from wtforms.validators import InputRequired, Email, Length, ValidationError
from helpers import load_deny_list
class LoginForm(FlaskForm):
email = StringField('Email', validators=[InputRequired(), Email(), Length(min=6, max=55)])
password = PasswordField('Password', validators=[InputRequired()])
submit = SubmitField('Login')
class RegistrationForm(FlaskForm):
email = StringField('Email', validators=[InputRequired(), Email(), Length(min=6, max=55)])
password = PasswordField('Password', validators=[InputRequired(), Length(min=8, max=30)],
description='Password must be at least 8 characters long but no more than 30 characters.')
submit = SubmitField('Register')
def validate_password(self, password):
deny_list = load_deny_list()
if password.data.lower() in deny_list:
raise ValidationError('Password is too common.')
class ModuleForm(FlaskForm):
code = StringField('Code', validators=[InputRequired(), Length(min=2, max=7)])
name = StringField('Title', validators=[InputRequired(), Length(min=7, max=55)])
description = StringField('Description', validators=[InputRequired(), Length(min=2, max=255)])
submit = SubmitField('Add Module')
class CommentForm(FlaskForm):
text = TextAreaField('Comment', validators=[InputRequired(), Length(min=1, max=400)])
submit = SubmitField('Add Comment')