realms-wiki/realms/modules/auth/forms.py

24 lines
779 B
Python
Raw Normal View History

2014-08-30 18:06:12 +03:00
from flask_wtf import Form, RecaptchaField
from wtforms import StringField, PasswordField, validators
from realms import app
2014-08-20 18:28:25 +03:00
2014-08-20 18:28:25 +03:00
class RegistrationForm(Form):
username = StringField('Username', [validators.Length(min=4, max=25)])
email = StringField('Email Address', [validators.Length(min=6, max=35)])
password = PasswordField('Password', [
validators.DataRequired(),
validators.EqualTo('confirm', message='Passwords must match')
])
confirm = PasswordField('Repeat Password')
if app.config['RECAPTCHA_ENABLE']:
2014-08-30 18:06:12 +03:00
setattr(RegistrationForm, 'recaptcha', RecaptchaField("You Human?"))
2014-08-20 18:28:25 +03:00
class LoginForm(Form):
2014-08-30 18:06:12 +03:00
email = StringField('Email', [validators.DataRequired()])
password = PasswordField('Password', [validators.DataRequired()])
2014-08-20 18:28:25 +03:00