Fix the redirect

Need to attempt to resume session to know whether we are authenticated.
This commit is contained in:
David Heinemeier Hansson 2024-07-28 14:57:38 -07:00
parent c01ee683aa
commit 1dd37e0193
1 changed files with 7 additions and 1 deletions

View File

@ -3,7 +3,13 @@ class SessionsController < ApplicationController
rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_url, alert: "Try again later." }
def new
redirect_to root_url if authenticated?
resume_session
if authenticated?
redirect_to root_url
else
render
end
end
def create