@@ -25,8 +25,7 class AccountController < ApplicationController | |||||
25 | # Login request and validation |
|
25 | # Login request and validation | |
26 | def login |
|
26 | def login | |
27 | if request.get? |
|
27 | if request.get? | |
28 |
|
|
28 | logout_user | |
29 | self.logged_user = nil |
|
|||
30 | else |
|
29 | else | |
31 | # Authenticate user |
|
30 | # Authenticate user | |
32 | if Setting.openid? && using_open_id? |
|
31 | if Setting.openid? && using_open_id? | |
@@ -39,9 +38,7 class AccountController < ApplicationController | |||||
39 |
|
38 | |||
40 | # Log out current user and redirect to welcome page |
|
39 | # Log out current user and redirect to welcome page | |
41 | def logout |
|
40 | def logout | |
42 | cookies.delete :autologin |
|
41 | logout_user | |
43 | Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) if User.current.logged? |
|
|||
44 | self.logged_user = nil |
|
|||
45 | redirect_to home_url |
|
42 | redirect_to home_url | |
46 | end |
|
43 | end | |
47 |
|
44 | |||
@@ -134,7 +131,15 class AccountController < ApplicationController | |||||
134 | end |
|
131 | end | |
135 |
|
132 | |||
136 | private |
|
133 | private | |
137 |
|
134 | |||
|
135 | def logout_user | |||
|
136 | if User.current.logged? | |||
|
137 | cookies.delete :autologin | |||
|
138 | Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) | |||
|
139 | self.logged_user = nil | |||
|
140 | end | |||
|
141 | end | |||
|
142 | ||||
138 | def password_authentication |
|
143 | def password_authentication | |
139 | user = User.try_to_login(params[:username], params[:password]) |
|
144 | user = User.try_to_login(params[:username], params[:password]) | |
140 |
|
145 |
General Comments 0
You need to be logged in to leave comments.
Login now