X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/4ceebefefaac05e3770ad232a6bc1839637962d3..76a46824a469d31f1a00164586bad959d990bf66:/app/controllers/application_controller.rb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index a30816a8e..488e6a818 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -22,7 +22,7 @@ class ApplicationController < ActionController::Base def authorize_web if session[:user] - self.current_user = User.where(:id => session[:user], :status => %w[active confirmed suspended]).first + self.current_user = User.find_by(:id => session[:user], :status => %w[active confirmed suspended]) if session[:fingerprint] && session[:fingerprint] != current_user.fingerprint @@ -44,8 +44,6 @@ class ApplicationController < ActionController::Base redirect_to :controller => "users", :action => "terms", :referer => request.fullpath end end - elsif session[:token] - session[:user] = current_user.id if self.current_user = User.authenticate(:token => session[:token]) end session[:fingerprint] = current_user.fingerprint if current_user && session[:fingerprint].nil? @@ -199,7 +197,7 @@ class ApplicationController < ActionController::Base ## # wrap a web page in a timeout def web_timeout(&block) - Timeout.timeout(Settings.web_timeout, Timeout::Error, &block) + Timeout.timeout(Settings.web_timeout, &block) rescue ActionView::Template::Error => e e = e.cause