summaryrefslogtreecommitdiffstats
path: root/app/controllers/account_controller.rb
diff options
context:
space:
mode:
authorEric Davis <edavis@littlestreamsoftware.com>2010-03-04 05:33:49 +0000
committerEric Davis <edavis@littlestreamsoftware.com>2010-03-04 05:33:49 +0000
commitbc79caaf69d1abb2605ccaea1bc386086300b338 (patch)
tree22ae96ee43a7de9432e6367124d38fcf2163ac7d /app/controllers/account_controller.rb
parentbe20d98040789626885b6697a040d1d5fecb2274 (diff)
downloadredmine-bc79caaf69d1abb2605ccaea1bc386086300b338.tar.gz
redmine-bc79caaf69d1abb2605ccaea1bc386086300b338.zip
Refactor: Extract method
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3537 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/account_controller.rb')
-rw-r--r--app/controllers/account_controller.rb15
1 files changed, 9 insertions, 6 deletions
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index d48fdb4dc..b459906cb 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -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,13 @@ class AccountController < ApplicationController
end
private
-
+
+ def logout_user
+ cookies.delete :autologin
+ Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) if User.current.logged?
+ self.logged_user = nil
+ end
+
def password_authentication
user = User.try_to_login(params[:username], params[:password])