上次登录的地址用户id变为当前用户id

This commit is contained in:
lizanle 2015-08-29 11:35:33 +08:00
parent 5e485e5175
commit 2b7beaeae8
1 changed files with 1 additions and 0 deletions

View File

@ -563,6 +563,7 @@ class ApplicationController < ActionController::Base
uri = URI.parse(back_url)
# do not redirect user to another host or to the login or register page
if (uri.relative? || (uri.host == request.host)) && !uri.path.match(%r{/(login|account/register)})
back_url = back_url.gsub(%r{\/users\/(\d+)},"/users/"+default.id.to_s)
redirect_to(back_url)
return
end