Format auth_type in a consistent way in the UI

On the ‘find user’ page it says ‘sms_auth’ instead of ‘Text message
code’.

This commit fixes that, and adds a handy formatter so it’s easier to do
the right thing in the future.
This commit is contained in:
Chris Hill-Scott
2022-03-14 14:39:54 +00:00
parent 34c2c3b47c
commit 9a1a328aca
6 changed files with 26 additions and 12 deletions

View File

@@ -50,7 +50,11 @@ from wtforms.validators import (
Regexp,
)
from app.formatters import format_thousands, guess_name_from_email_address
from app.formatters import (
format_auth_type,
format_thousands,
guess_name_from_email_address,
)
from app.main.validators import (
BroadcastLength,
CommonlyUsedPassword,
@@ -1021,8 +1025,8 @@ class AuthTypeForm(StripWhitespaceForm):
auth_type = GovukRadiosField(
'Sign in using',
choices=[
('sms_auth', 'Text message code'),
('email_auth', 'Email link'),
('sms_auth', format_auth_type('sms_auth')),
('email_auth', format_auth_type('email_auth')),
]
)