从主页登陆时跳转到个人主页

This commit is contained in:
z9hang 2014-05-15 15:53:28 +08:00
parent dcc2789aae
commit a794d612af
1 changed files with 15 additions and 6 deletions

View File

@ -31,9 +31,9 @@ class AccountController < ApplicationController
else else
authenticate_user authenticate_user
end end
rescue AuthSourceException => e #rescue AuthSourceException => e
logger.error "An error occured when authenticating #{params[:username]}: #{e.message}" # logger.error "An error occured when authenticating #{params[:username]}: #{e.message}"
render_error :message => e.message # render_error :message => e.message
end end
# Log out current user and redirect to welcome page # Log out current user and redirect to welcome page
@ -261,9 +261,18 @@ class AccountController < ApplicationController
end end
call_hook(:controller_account_success_authentication_after, {:user => user }) call_hook(:controller_account_success_authentication_after, {:user => user })
#by young #by young
# redirect_back_or_default my_page_path code = //
redirect_back_or_default User.current #根据home_url生产正则表达式
# redirect_to User.current class_eval("code = " + "/" + home_url.gsub(/\//,"\\\/") + "\\\/*(welcome)?\\\/*(\\\/index)?\/")
if code.match(params[:back_url])
redirect_to user_activities_path(user)
else
#redirect_back_or_default my_page_path
redirect_back_or_default User.current
#redirect_to User.current
end
end end
def set_autologin_cookie(user) def set_autologin_cookie(user)