]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/sessions_controller.rb
Attempt to avoid polynomial time matches on user supplied data
[rails.git] / app / controllers / sessions_controller.rb
index 7e6a740f3e1a1e86ef4d4d4be5e6936959086084..bb3854e69b3d48348c394faa8dbc4ec6b2b2ac48 100644 (file)
@@ -34,10 +34,14 @@ class SessionsController < ApplicationController
         token&.destroy
         session.delete(:token)
       end
         token&.destroy
         session.delete(:token)
       end
+
       session.delete(:user)
       session_expires_automatically
       session.delete(:user)
       session_expires_automatically
-      if params[:referer]
-        redirect_to safe_referer(params[:referer])
+
+      referer = safe_referer(params[:referer]) if params[:referer]
+
+      if referer
+        redirect_to referer
       else
         redirect_to :controller => "site", :action => "index"
       end
       else
         redirect_to :controller => "site", :action => "index"
       end