when redirecting to /login, save the url and params to redirect back to
closes #164
This commit is contained in:
parent
85cb7c2057
commit
243b29240a
|
@ -55,6 +55,10 @@ class ApplicationController < ActionController::Base
|
|||
if @user
|
||||
true
|
||||
else
|
||||
if request.get?
|
||||
session[:redirect_to] = request.original_fullpath
|
||||
end
|
||||
|
||||
redirect_to "/login"
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,7 +24,13 @@ class LoginController < ApplicationController
|
|||
if user && user.is_active? &&
|
||||
user.try(:authenticate, params[:password].to_s)
|
||||
session[:u] = user.session_token
|
||||
return redirect_to "/"
|
||||
|
||||
if (rd = session[:redirect_to]).present?
|
||||
session.delete(:redirect_to)
|
||||
return redirect_to rd
|
||||
else
|
||||
return redirect_to "/"
|
||||
end
|
||||
end
|
||||
|
||||
flash.now[:error] = "Invalid e-mail address and/or password."
|
||||
|
|
Loading…
Reference in a new issue