mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-07 14:18:24 -04:00
Added fixes for forms to hide potential email philshing scams.
This commit is contained in:
@@ -105,9 +105,6 @@ class LoginForm(Form):
|
||||
|
||||
|
||||
class RegisterUserForm(Form):
|
||||
def __init__(self, unique_email_func, *args, **kwargs):
|
||||
self.unique_email_func = unique_email_func
|
||||
super(RegisterUserForm, self).__init__(*args, **kwargs)
|
||||
|
||||
name = StringField('Full name',
|
||||
validators=[DataRequired(message='Name can not be empty')])
|
||||
@@ -115,11 +112,6 @@ class RegisterUserForm(Form):
|
||||
mobile_number = mobile_number()
|
||||
password = password()
|
||||
|
||||
def validate_email_address(self, field):
|
||||
# Validate email address is unique.
|
||||
if not self.unique_email_func(field.data):
|
||||
raise ValidationError('Email address already exists')
|
||||
|
||||
|
||||
class TwoFactorForm(Form):
|
||||
def __init__(self, validate_code_func, *args, **kwargs):
|
||||
@@ -221,17 +213,8 @@ class TemplateForm(Form):
|
||||
|
||||
|
||||
class ForgotPasswordForm(Form):
|
||||
|
||||
def __init__(self, user_email_exists_func, *args, **kwargs):
|
||||
self._user_email_exists_func = user_email_exists_func
|
||||
super(ForgotPasswordForm, self).__init__(*args, **kwargs)
|
||||
|
||||
email_address = email_address()
|
||||
|
||||
def validate_email_address(self, field):
|
||||
if not self._user_email_exists_func(field.data):
|
||||
raise ValidationError('The email is not registered on our system')
|
||||
|
||||
|
||||
class NewPasswordForm(Form):
|
||||
new_password = password()
|
||||
|
||||
Reference in New Issue
Block a user