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
+3 -2
View File
@@ -1,8 +1,9 @@
import { startRegistration, startAuthentication } from '@simplewebauthn/browser'
import aWebSocket from '@/utils/awaitable-websocket'
export async function register() {
const ws = await aWebSocket("/auth/ws/register")
export async function register(resetToken = null) {
const url = resetToken ? `/auth/ws/register?reset=${encodeURIComponent(resetToken)}` : "/auth/ws/register"
const ws = await aWebSocket(url)
try {
const optionsJSON = await ws.receive_json()
const registrationResponse = await startRegistration({ optionsJSON })