Merge pull request #153 from ChrisBr/redirect_admin
Redirects to admin/index after admin login
This commit is contained in:
commit
989848ce88
1 changed files with 13 additions and 6 deletions
|
|
@ -9,13 +9,20 @@ class ApplicationController < ActionController::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_sign_in_path_for(resource)
|
def after_sign_in_path_for(resource)
|
||||||
if session[:return_to] &&
|
if organizer_or_admin? &&
|
||||||
!session[:return_to].start_with?(user_registration_path)
|
(!session[:return_to] ||
|
||||||
logger.debug "Returning to #{session[:return_to]}"
|
session[:return_to] &&
|
||||||
session[:return_to]
|
session[:return_to] == root_path)
|
||||||
|
admin_conference_index_path
|
||||||
else
|
else
|
||||||
logger.debug "Not returning to #{session[:return_to]} because it would loop"
|
if session[:return_to] &&
|
||||||
super
|
!session[:return_to].start_with?(user_registration_path)
|
||||||
|
logger.debug "Returning to #{session[:return_to]}"
|
||||||
|
session[:return_to]
|
||||||
|
else
|
||||||
|
logger.debug "Not returning to #{session[:return_to]} because it would loop"
|
||||||
|
super
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue