login fix

This commit is contained in:
Andreas Stephanides
2014-11-10 20:20:36 +01:00
parent 68fb657c97
commit 24c76a7f5d
2 changed files with 26 additions and 2 deletions

View File

@@ -19,9 +19,24 @@
if request.referer == sign_in_url
super
else
stored_location_for(resource) || request.referer || root_path
stored_location_for(resource) || root_path
end
end^
end
rescue_from CanCan::AccessDenied do |exception|
if user_signed_in?
flash[:error] = "Not authorized to view this page"
session[:user_return_to] = nil
redirect_to root_url
else
flash[:error] = "You must first login to view this page"
session[:user_return_to] = request.url
redirect_to "/users/sign_in"
end
end
def get_theme
if ThemesForRails.available_theme_names.include?(params[:theme])
params[:theme]