mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-29 17:08:31 -04:00
Allow spaces and dashes in the two factor code
I noticed when using the dication software that saying ‘one two three four five’ got dictated as `123 45`. This tripped the validation, because the space character isn’t a digit. So this commit normalises out spaces (and other spacing characters like dashes and underscores) before validating the code and sending it to the API. I can also imagine that some people might like to space out the code to make it easier to transcribe (like you might do with a credit card number).
This commit is contained in:
@@ -177,6 +177,10 @@ class SMSCode(StringField):
|
||||
def __call__(self, **kwargs):
|
||||
return super().__call__(type='tel', pattern='[0-9]*', **kwargs)
|
||||
|
||||
def process_formdata(self, valuelist):
|
||||
if valuelist:
|
||||
self.data = Columns.make_key(valuelist[0])
|
||||
|
||||
|
||||
class ForgivingIntegerField(StringField):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user