Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Commit

Permalink
Preserve the attempted path upon failed authentication
Browse files Browse the repository at this point in the history
Modify app.rb route '/auth/unauthenticated' do ensure that the
return to path of session[:return_to] will remain even after
a failed authentication attempt.
  • Loading branch information
awesomelionel committed Jun 16, 2014
1 parent d2dd5c6 commit 5c9842e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app.rb
Expand Up @@ -80,7 +80,7 @@ def authenticate!
end

post '/auth/unauthenticated' do
session[:return_to] = env['warden.options'][:attempted_path]
session[:return_to] = env['warden.options'][:attempted_path] if session[:return_to].nil?
puts env['warden.options'][:attempted_path]
puts env['warden']
flash[:error] = env['warden'].message || "You must log in"
Expand All @@ -92,4 +92,4 @@ def authenticate!

erb :protected
end
end
end

0 comments on commit 5c9842e

Please sign in to comment.