|
|
|
@ -63,8 +63,6 @@ class ApplicationController < ActionController::Base |
|
|
|
|
|
|
|
|
|
before_filter :user_setup, :check_if_login_required, :set_localization |
|
|
|
|
filter_parameter_logging :password |
|
|
|
|
before_filter :check_for_first_login, :if => :check_if_login_required |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token |
|
|
|
|
|
|
|
|
@ -283,12 +281,7 @@ class ApplicationController < ActionController::Base |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def redirect_back_or_default(default) |
|
|
|
|
redirect_to default if (redirect_back == false) |
|
|
|
|
false |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def redirect_back |
|
|
|
|
back_url = CGI.unescape(params[:back_url].to_s) |
|
|
|
|
back_url = URI.escape(CGI.unescape(params[:back_url].to_s)) |
|
|
|
|
if !back_url.blank? |
|
|
|
|
begin |
|
|
|
|
uri = URI.parse(back_url) |
|
|
|
@ -298,9 +291,10 @@ class ApplicationController < ActionController::Base |
|
|
|
|
return |
|
|
|
|
end |
|
|
|
|
rescue URI::InvalidURIError |
|
|
|
|
# don't do anything |
|
|
|
|
# redirect to default |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
redirect_to default |
|
|
|
|
false |
|
|
|
|
end |
|
|
|
|
|
|
|
|
@ -491,25 +485,6 @@ class ApplicationController < ActionController::Base |
|
|
|
|
render options |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
def check_for_first_login |
|
|
|
|
user = User.current |
|
|
|
|
return true if (!user.first_login or !user.logged?) |
|
|
|
|
user.first_login = false |
|
|
|
|
user.save |
|
|
|
|
if request.get? |
|
|
|
|
url = url_for(params) |
|
|
|
|
else |
|
|
|
|
url = url_for(:controller => params[:controller], :action => params[:action], :id => params[:id], :project_id => params[:project_id]) |
|
|
|
|
end |
|
|
|
|
respond_to do |format| |
|
|
|
|
format.html { redirect_to :controller => "users", :action => "set_impaired_flag", :id => User.current, :back_url => url } |
|
|
|
|
format.atom { redirect_to :controller => "users", :action => "set_impaired_flag", :id => User.current, :back_url => url } |
|
|
|
|
format.xml { head :unauthorized } |
|
|
|
|
format.json { head :unauthorized } |
|
|
|
|
end |
|
|
|
|
false |
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
# Overrides #default_template so that the api template |
|
|
|
|
# is used automatically if it exists |
|
|
|
|
def default_template(action_name = self.action_name) |
|
|
|
|