Remodel reset token handling due to browsers sometimes refusing to set the cookie when opening the link (from another site).

This commit is contained in:
2025-08-31 03:54:17 +00:00
parent 54cef0f9d6
commit ad4bde5d0d
8 changed files with 113 additions and 89 deletions
+8 -6
View File
@@ -27,12 +27,14 @@ async function register() {
authStore.showMessage('Starting registration...', 'info')
try {
const result = await passkey.register()
console.log("Result", result)
await authStore.setSessionCookie(result.session_token)
authStore.showMessage('Passkey registered successfully!', 'success', 2000)
authStore.loadUserInfo().then(authStore.selectView)
const result = await passkey.register(authStore.resetToken)
console.log("Result", result)
await authStore.setSessionCookie(result.session_token)
// resetToken cleared by setSessionCookie; ensure again
authStore.resetToken = null
authStore.showMessage('Passkey registered successfully!', 'success', 2000)
await authStore.loadUserInfo()
authStore.selectView()
} catch (error) {
authStore.showMessage(`Registration failed: ${error.message}`, 'error')
} finally {