New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEV: Add UI for passkeys (3/3) #23853
Conversation
2d44285
to
7eb08bf
Compare
83cbdeb
to
a7c077c
Compare
app/assets/javascripts/discourse/app/components/dialog-messages/confirm-session.gjs
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/dialog-messages/confirm-session.gjs
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/dialog-messages/confirm-session.gjs
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/dialog-messages/confirm-session.gjs
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/dialog-messages/confirm-session.gjs
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/passkey-login-button.gjs
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/user-preferences/passkey-options-dropdown.js
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/user-preferences/rename-passkey.gjs
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/user-preferences/rename-passkey.gjs
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/user-preferences/rename-passkey.gjs
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/user-preferences/user-passkeys.hbs
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/app/components/user-preferences/user-passkeys.js
Outdated
Show resolved
Hide resolved
return errorCallback(I18n.t("login.security_key_support_missing_error")); | ||
} | ||
|
||
return navigator.credentials |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await?
Co-authored-by: Joffrey JAFFEUX <j.jaffeux@gmail.com>
return; | ||
} | ||
|
||
this.router.refresh(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this returns a transition, I think it would be more correct to await here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, here the user is adding a new key, and we're about to show them a modal to name that key, but in the meantime, the key's already been stored. The call to this.router.refresh
is updating the list of keys that is shown behind the dialog's overlay. In a sense, this is a background action, and the next item in the flow (showing the rename dialog) doesn't depend on the router refresh. In that sense, adding await
isn't useful. (I do get that adding await
would be more correct/consistent, but it would also be a tiny bit slower.)
didConfirm: () => { | ||
this.args.model.deletePasskey(id).then(() => { | ||
this.router.refresh(); | ||
}); | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are various cases like this where we have promises which are kinda lost, ultimately it can make the UI complicated to reason about, for example here you need some schedule("afterRender"
which should really not
be necessary from what I see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the afterRender
is here for a different reason, it has to do with showing subsequent dialogs (already not a good idea) and the didConfirm
event... I'll look into a refactor for that shortly.
app/assets/javascripts/discourse/tests/acceptance/user-preferences-security-test.js
Outdated
Show resolved
Hide resolved
app/assets/javascripts/discourse/tests/acceptance/user-preferences-security-test.js
Outdated
Show resolved
Hide resolved
This pull request has been mentioned on Discourse Meta. There might be relevant details there: https://meta.discourse.org/t/support-passwordless-login-with-passkeys/229259/34 |
<span class="prefix"> | ||
{{this.addedPrefix}} | ||
</span> | ||
{{this.formatDate | ||
passkey.created_at | ||
format="medium" | ||
leaveAgo="true" | ||
}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pmusaraj Ideally the date would be a parameter of the translation. Joining those strings together makes it harder to translate. The same applies to the usage of {{this.lastUsedPrefix}}
a couple of lines below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call @gschlager, should be addressed now in #26178
See #23587 and #23586 for the backend implementation.
passkey-register-rename.mp4
passkeys-auth.mp4
This is all behind a hidden site setting, so it's still in an early stage, not production-ready yet.