Add endpoints for forgot-password.

This commit is contained in:
Rebecca Law
2016-01-04 14:00:39 +00:00
parent 567ac123e3
commit 6696426dbc
10 changed files with 145 additions and 11 deletions

View File

@@ -1,10 +1,7 @@
from datetime import datetime
from flask_wtf import Form
from wtforms import StringField, PasswordField, ValidationError
from wtforms.validators import DataRequired, Email, Length, Regexp
from app.main.dao import verify_codes_dao
from app.main.encryption import check_hash
from app.main.validators import Blacklist, ValidateUserCodes
@@ -123,3 +120,14 @@ class AddServiceForm(Form):
def validate_service_name(self, a):
if self.service_name.data in self.service_names:
raise ValidationError('Service name already exists')
class ForgotPassword(Form):
email_address = StringField('Email address',
validators=[Length(min=5, max=255),
DataRequired(message='Email cannot be empty'),
Email(message='Please enter a valid email address'),
Regexp(regex=gov_uk_email, message='Please enter a gov.uk email address')
])