mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-28 17:01:16 +00:00
Make passkey login default
This commit is contained in:
@@ -5,6 +5,7 @@ Alpine.data('passkeyLogin', () => ({
|
||||
busy: false,
|
||||
error: '',
|
||||
showCreateHint: false,
|
||||
hasAutoPrompted: false,
|
||||
|
||||
init() {
|
||||
this.supported = typeof window.browserSupportsWebAuthn === 'function'
|
||||
@@ -13,6 +14,18 @@ Alpine.data('passkeyLogin', () => ({
|
||||
// If backend already reported an invalid passkey login attempt,
|
||||
// immediately show the "sign in first, then create passkey" guidance.
|
||||
this.showCreateHint = this.$el.dataset.serverPasskeyError === '1';
|
||||
|
||||
const shouldAutoPrompt = this.$el.dataset.autoPrompt === '1';
|
||||
if (this.supported && shouldAutoPrompt && !this.showCreateHint) {
|
||||
window.requestAnimationFrame(() => {
|
||||
if (this.hasAutoPrompted || this.busy) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.hasAutoPrompted = true;
|
||||
void this.authenticate();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
async authenticate() {
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
@endif
|
||||
|
||||
<div x-show="!showPassword" x-cloak>
|
||||
@include('partials.passkey-authenticate')
|
||||
@include('partials.passkey-authenticate', ['autoPromptPasskey' => ! $errors->any()])
|
||||
|
||||
<button
|
||||
type="button"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
x-cloak
|
||||
data-options-url="{{ route('passkeys.authentication_options') }}"
|
||||
data-server-passkey-error="{{ session('authenticatePasskey::reason') === 'invalid_passkey' ? '1' : '0' }}"
|
||||
data-auto-prompt="{{ ($autoPromptPasskey ?? true) ? '1' : '0' }}"
|
||||
data-captcha-enabled="{{ \App\Support\CaptchaHelper::isEnabled() ? '1' : '0' }}"
|
||||
data-captcha-field="{{ \App\Support\CaptchaHelper::isEnabled() ? \App\Support\CaptchaHelper::getResponseFieldName() : '' }}"
|
||||
class="mt-6"
|
||||
|
||||
Reference in New Issue
Block a user