mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-28 05:01:06 -04:00
Completion of forgot-password endpoints.
Start implementation for new-password endpoints. Created PasswordResetToken model ToDo: create and save token, send valid url to user, check validity of token, update user's password, redirect to /two-factor.
This commit is contained in:
@@ -122,7 +122,11 @@ class AddServiceForm(Form):
|
||||
raise ValidationError('Service name already exists')
|
||||
|
||||
|
||||
class ForgotPassword(Form):
|
||||
class ForgotPasswordForm(Form):
|
||||
def __init__(self, email_addresses, *args, **kargs):
|
||||
self.email_addresses = email_addresses
|
||||
super(ForgotPasswordForm, self).__init__(*args, **kargs)
|
||||
|
||||
email_address = StringField('Email address',
|
||||
validators=[Length(min=5, max=255),
|
||||
DataRequired(message='Email cannot be empty'),
|
||||
@@ -130,4 +134,8 @@ class ForgotPassword(Form):
|
||||
Regexp(regex=gov_uk_email, message='Please enter a gov.uk email address')
|
||||
])
|
||||
|
||||
def validate_email_address(self, a):
|
||||
if self.email_address.data not in self.email_addresses:
|
||||
raise ValidationError('Please enter the email address that you registered with')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user