docker-k8s-devops/chapter5/labs/flask-skeleton/skeleton/server/user/forms.py

29 lines
816 B
Python
Executable File

# Copyright 2016 Cisco Systems, Inc.
# All rights reserved.
from flask_wtf import Form
from wtforms import StringField, PasswordField
from wtforms.validators import DataRequired, Email, Length, EqualTo
class LoginForm(Form):
email = StringField('Email Address', [DataRequired(), Email()])
password = PasswordField('Password', [DataRequired()])
class RegisterForm(Form):
email = StringField(
'Email Address',
validators=[DataRequired(), Email(message=None), Length(min=6, max=40)])
password = PasswordField(
'Password',
validators=[DataRequired(), Length(min=6, max=25)]
)
confirm = PasswordField(
'Confirm password',
validators=[
DataRequired(),
EqualTo('password', message='Passwords must match.')
]
)