Skip to content

Commit

Permalink
login redirects to referring page if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwest committed Mar 2, 2010
1 parent e11ac10 commit d1a71a1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/authr/sessions_controller.rb
Expand Up @@ -7,7 +7,7 @@ def create
if account = Account.authenticate(params[:account][:uname], params[:account][:password]) if account = Account.authenticate(params[:account][:uname], params[:account][:password])
session[:account_id] = account.id session[:account_id] = account.id
session[:account_login_time] = Time.now session[:account_login_time] = Time.now
redirect_to '/' redirect_to (session[:return_to]) ? session[:return_to] : '/'
else else
redirect_to new_session_path redirect_to new_session_path
end end
Expand Down
1 change: 1 addition & 0 deletions lib/extensions/action_controller/base.rb
Expand Up @@ -12,6 +12,7 @@ def self.skip_authentication!(options = {})


def authenticate_session def authenticate_session
unless valid_session? || [new_session_path, session_path].include?(request.request_uri) unless valid_session? || [new_session_path, session_path].include?(request.request_uri)
session[:return_to] = request.request_uri
redirect_to new_session_path redirect_to new_session_path
end end
end end
Expand Down

0 comments on commit d1a71a1

Please sign in to comment.