]> source.dussan.org Git - redmine.git/commitdiff
Merged r3537 and r3572 from trunk.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 11 Apr 2010 14:29:02 +0000 (14:29 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 11 Apr 2010 14:29:02 +0000 (14:29 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/0.9-stable@3644 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/account_controller.rb

index b1500d42832543419de44ab29fd15c93401f246e..df5186c867cb38a84f70fa38e97058a08e389286 100644 (file)
@@ -25,8 +25,7 @@ class AccountController < ApplicationController
   # Login request and validation
   def login
     if request.get?
-      # Logout user
-      self.logged_user = nil
+      logout_user
     else
       # Authenticate user
       if Setting.openid? && using_open_id?
@@ -39,9 +38,7 @@ class AccountController < ApplicationController
 
   # Log out current user and redirect to welcome page
   def logout
-    cookies.delete :autologin
-    Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) if User.current.logged?
-    self.logged_user = nil
+    logout_user
     redirect_to home_url
   end
   
@@ -134,7 +131,15 @@ class AccountController < ApplicationController
   end
   
   private
-
+  
+  def logout_user
+    if User.current.logged?
+      cookies.delete :autologin
+      Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin'])
+      self.logged_user = nil
+    end
+  end
+  
   def password_authentication
     user = User.try_to_login(params[:username], params[:password])