forked from johnschimmel/Python-Flask-Login-Sample
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforms.py
More file actions
15 lines (12 loc) · 626 Bytes
/
forms.py
File metadata and controls
15 lines (12 loc) · 626 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import models
from flask.ext.mongoengine.wtf import model_form
from wtforms.fields import *
from flask.ext.mongoengine.wtf.orm import validators
user_form = model_form(models.User, exclude=['password'])
# Signup Form created from user_form
class SignupForm(user_form):
password = PasswordField('Password', validators=[validators.Required(), validators.EqualTo('confirm', message='Passwords must match')])
confirm = PasswordField('Repeat Password')
# Login form will provide a Password field (WTForm form field)
class LoginForm(user_form):
password = PasswordField('Password',validators=[validators.Required()])