]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/user_controller.rb
Require the session ID to log somebody out - if it isn't given we just
[rails.git] / app / controllers / user_controller.rb
index db8a509bd1f30aa62537d69c8cfa1b9b93b84069..9551ac6d8fbdd1e21524a6d1f7065f079c7618b9 100644 (file)
@@ -182,19 +182,23 @@ class UserController < ApplicationController
   end
 
   def logout
-    if session[:token]
-      token = UserToken.find_by_token(session[:token])
-      if token
-        token.destroy
+    @title = t 'user.logout.title'
+
+    if params[:session] == request.session_options[:id]
+      if session[:token]
+        token = UserToken.find_by_token(session[:token])
+        if token
+          token.destroy
+        end
+        session[:token] = nil
+      end
+      session[:user] = nil
+      session_expires_automatically
+      if params[:referer]
+        redirect_to params[:referer]
+      else
+        redirect_to :controller => 'site', :action => 'index'
       end
-      session[:token] = nil
-    end
-    session[:user] = nil
-    session_expires_automatically
-    if params[:referer]
-      redirect_to params[:referer]
-    else
-      redirect_to :controller => 'site', :action => 'index'
     end
   end