mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 00:20:43 -04:00
Merge pull request #177 from alphagov/easier-registration
Make registration and forgot password pages better
This commit is contained in:
@@ -9,6 +9,7 @@ from wtforms import (
|
||||
FileField,
|
||||
RadioField
|
||||
)
|
||||
from wtforms.fields.html5 import EmailField, TelField
|
||||
from wtforms.validators import DataRequired, Email, Length, Regexp
|
||||
|
||||
from app.main.validators import Blacklist, CsvFileValidator
|
||||
@@ -23,14 +24,14 @@ from app.main.utils import (
|
||||
def email_address():
|
||||
gov_uk_email \
|
||||
= "(^[^@^\\s]+@[^@^\\.^\\s]+(\\.[^@^\\.^\\s]*)*.gov.uk)"
|
||||
return StringField('Email address', validators=[
|
||||
return EmailField('Email address', validators=[
|
||||
Length(min=5, max=255),
|
||||
DataRequired(message='Email cannot be empty'),
|
||||
Email(message='Enter a valid email address'),
|
||||
Regexp(regex=gov_uk_email, message='Enter a gov.uk email address')])
|
||||
|
||||
|
||||
class UKMobileNumber(StringField):
|
||||
class UKMobileNumber(TelField):
|
||||
|
||||
def pre_validate(self, form):
|
||||
try:
|
||||
|
||||
@@ -19,6 +19,7 @@ def forgot_password():
|
||||
users_dao.request_password_reset(user)
|
||||
send_change_password_email(form.email_address.data)
|
||||
return render_template('views/password-reset-sent.html')
|
||||
flash('There was an error processing your request')
|
||||
else:
|
||||
return render_template('views/password-reset-sent.html')
|
||||
|
||||
return render_template('views/forgot-password.html', form=form)
|
||||
|
||||
Reference in New Issue
Block a user