2014-08-30 18:06:12 +03:00
|
|
|
from flask_wtf import Form, RecaptchaField
|
|
|
|
from wtforms import StringField, PasswordField, validators
|
|
|
|
from realms import config
|
2014-08-20 18:28:25 +03:00
|
|
|
|
2014-09-14 06:47:17 +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')
|
|
|
|
|
2014-08-30 18:06:12 +03:00
|
|
|
if config.RECAPTCHA_ENABLE:
|
|
|
|
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
|
|
|
|
|
|
|
|