mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-28 01:50:12 -04:00
Refactor into model
It’s generally an antipattern for the view layer code to be calling the API client directly.
This commit is contained in:
@@ -52,9 +52,7 @@ def webauthn_complete_register():
|
||||
current_app.logger.info(f'User {current_user.id} could not register a new webauthn token - {e}')
|
||||
return cbor.encode(str(e)), 400
|
||||
|
||||
user_api_client.create_webauthn_credential_for_user(
|
||||
current_user.id, credential
|
||||
)
|
||||
current_user.create_webauthn_credential(credential)
|
||||
|
||||
flash((
|
||||
'Registration complete. Next time you sign in to Notify '
|
||||
|
||||
@@ -360,6 +360,11 @@ class User(JSONModel, UserMixin):
|
||||
for credential in self.webauthn_credentials
|
||||
]
|
||||
|
||||
def create_webauthn_credential(self, credential):
|
||||
user_api_client.create_webauthn_credential_for_user(
|
||||
self.id, credential
|
||||
)
|
||||
|
||||
def serialize(self):
|
||||
dct = {
|
||||
"id": self.id,
|
||||
|
||||
Reference in New Issue
Block a user