[passkey] fix some bugs

*  in listing passkeys
* description
This commit is contained in:
tuxcoder 2023-12-26 12:55:45 +01:00
parent 471a49a80f
commit 7dff2a964f
3 changed files with 9 additions and 6 deletions

View file

@ -58,7 +58,7 @@
settings = { settings = {
HYDRA_ADMIN_URL = "http://127.0.0.1:8081"; HYDRA_ADMIN_URL = "http://127.0.0.1:8081";
HYDRA_PUBLIC_URL = "http://127.0.0.1:8082"; HYDRA_PUBLIC_URL = "http://127.0.0.1:8082";
PUBLIC_URL = "http://127.0.0.1:5000"; PUBLIC_URL = "http://localhost:5000";
ADMINS = [ "tuxcoder" ]; ADMINS = [ "tuxcoder" ];
}; };
}; };

View file

@ -43,9 +43,9 @@
<div> <div>
To register new credential: To register new credential:
<ol> <ol>
<li>Insert/connect authenticator and verify user presence.</li>
<li>Set name for the new credential.</li> <li>Set name for the new credential.</li>
<li>Submit the registration.</li> <li>Submit the registration.</li>
<li>Insert/connect authenticator and verify user presence.</li>
</ol> </ol>
</div> </div>

View file

@ -196,8 +196,12 @@ def app_token_delete(app_token_name: str) -> ResponseReturnValue:
def passkey() -> ResponseReturnValue: def passkey() -> ResponseReturnValue:
"""list registered credentials for current user""" """list registered credentials for current user"""
credentials = PasskeyCredential.query.all() user = get_current_user()
return render_template('frontend/passkey_list.html.j2', credentials=credentials, button_form=ButtonForm()) return render_template(
'frontend/passkey_list.html.j2',
credentials=user.passkey_credentials,
button_form=ButtonForm()
)
@ -205,9 +209,8 @@ def passkey() -> ResponseReturnValue:
def passkey_new() -> ResponseReturnValue: def passkey_new() -> ResponseReturnValue:
"""register credential for current user""" """register credential for current user"""
public_url = urlparse(current_app.config['PUBLIC_URL']) public_url = urlparse(current_app.config['PUBLIC_URL'])
user = get_current_user() # type: User user = get_current_user()
form = PasskeyRegisterForm() form = PasskeyRegisterForm()
options = webauthn.generate_registration_options( options = webauthn.generate_registration_options(