calendar-social/app/forms.py
2018-06-29 14:27:50 +02:00

16 lines
690 B
Python

from flask_babel import lazy_gettext as _
from flask_wtf import FlaskForm
from wtforms import PasswordField, StringField
from wtforms.validators import DataRequired, Email, ValidationError
class RegistrationForm(FlaskForm):
username = StringField(_('Username'), validators=[DataRequired()])
email = StringField(_('Email address'), validators=[Email()])
password = PasswordField(_('Password'), validators=[DataRequired()])
password_retype = PasswordField(_('Password, once more'), validators=[DataRequired()])
def validate_password_retype(self, field):
if field.data != self.password.data:
raise ValidationError(_('The two passwords must match!'))