Update docs. Implemented a one-time token to work around domain cookies not being immediately return by the browser. Reduce db queries on /api/verify requests.

This commit is contained in:
Dan Milne
2025-10-28 08:20:12 +11:00
parent da6fd5b800
commit 7074242907
5 changed files with 183 additions and 37 deletions

View File

@@ -67,6 +67,12 @@ class SessionsController < ApplicationController
if request.post?
code = params[:code]&.strip
# Check if user is already authenticated (prevent duplicate submissions)
if authenticated?
redirect_to root_path, notice: "Already signed in."
return
end
# Try TOTP verification first
if user.verify_totp(code)
session.delete(:pending_totp_user_id)