mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-09 19:04:33 -04:00
109638656: Implement two factor verify flow
When user enters valid sms code they are redirected to the dashboard. Otherwise, form errors are present.
This commit is contained in:
@@ -44,6 +44,14 @@ class RegisterUserForm(Form):
|
||||
class TwoFactorForm(Form):
|
||||
sms_code = IntegerField('sms code', validators=[DataRequired(message='Please enter your code')])
|
||||
|
||||
def validate_sms_code(self, a):
|
||||
if self.sms_code.data is not None:
|
||||
if checkpw(str(self.sms_code.data), session['sms_code']) is False:
|
||||
self.sms_code.errors.append('Code does not match')
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
class VerifyForm(Form):
|
||||
sms_code = StringField("Text message confirmation code",
|
||||
|
||||
Reference in New Issue
Block a user