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:
Leo Vasanko
2025-08-30 15:54:17 -06:00
parent 4f094a7016
commit 3e5c0065d5
8 changed files with 113 additions and 89 deletions

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 {