先注册新用户返回资料修改页面,再用老用户登录,却还是返回的资料修改页面,且不能对资料修改除外的其他模块进行操作
This commit is contained in:
parent
28f0f1edad
commit
9f063e024a
|
@ -577,19 +577,19 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def redirect_back_or_default(default, options={})
|
||||
back_url = params[:back_url].to_s
|
||||
back_url = ''#params[:back_url].to_s
|
||||
if back_url.present?
|
||||
begin
|
||||
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.to_s) if default.is_a?(User)
|
||||
back_url = back_url.gsub(%r{\/users\/(\w+)},"/users/"+default.to_s) if default.is_a?(:User)
|
||||
redirect_to(back_url)
|
||||
return
|
||||
end
|
||||
rescue URI::InvalidURIError
|
||||
logger.warn("Could not redirect to invalid URL #{back_url}")
|
||||
redirect to default
|
||||
#redirect to default
|
||||
end
|
||||
elsif options[:referer]
|
||||
redirect_to_referer_or default
|
||||
|
|
Loading…
Reference in New Issue