mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Avoid registering the same authenticator twice
This passes existing credentials in the server response, to allow the browser to prevent re-registering the same key for the same user. Registering the same key multiple times doesn't seem to be an issue technically; the user has likely got their keys mixed up. - Chrome says "you don't need to register it again". - Safari exits with an InvalidStateError. - Firefox exits with a DOMException.
This commit is contained in:
@@ -192,12 +192,9 @@ class UserApiClient(NotifyAdminAPIClient):
|
||||
return self.get(endpoint)
|
||||
|
||||
def get_webauthn_credentials_for_user(self, user_id):
|
||||
from datetime import datetime
|
||||
|
||||
return [{
|
||||
'name': 'Ben test',
|
||||
'created_at': datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%fZ")
|
||||
}]
|
||||
# TODO: remove when using real API
|
||||
self.credentials = getattr(self, 'credentials', [])
|
||||
return self.credentials
|
||||
|
||||
def create_webauthn_credential_for_user(self, user_id, credential):
|
||||
self.credentials = getattr(self, 'credentials', [])
|
||||
|
||||
Reference in New Issue
Block a user