summaryrefslogtreecommitdiff
path: root/users/app/controllers/sessions_controller.rb
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-10-05 13:00:52 +0200
committerAzul <azul@leap.se>2012-10-05 13:00:52 +0200
commit6cf3dacd4a4d0f30a41c6a75658443ce6192e750 (patch)
tree2eaea784e97de9652ce8c39ab2b4db9e32de5d1e /users/app/controllers/sessions_controller.rb
parent5fe296eb9f9b216e05921ac0c41f5defc1cc2054 (diff)
parentc89610d1aad8500b4f7058c970bb07a60a55a5ce (diff)
Merge remote-tracking branch 'origin/master' into develop
Conflicts: users/app/controllers/sessions_controller.rb
Diffstat (limited to 'users/app/controllers/sessions_controller.rb')
-rw-r--r--users/app/controllers/sessions_controller.rb6
1 files changed, 4 insertions, 2 deletions
diff --git a/users/app/controllers/sessions_controller.rb b/users/app/controllers/sessions_controller.rb
index f79b069..7852e5c 100644
--- a/users/app/controllers/sessions_controller.rb
+++ b/users/app/controllers/sessions_controller.rb
@@ -8,8 +8,8 @@ class SessionsController < ApplicationController
def create
@user = User.find_by_param(params[:login])
session[:handshake] = @user.initialize_auth(params['A'].hex)
- render :json => { :B => session[:handshake].bb.to_s(16),
- :salt => @user.password_salt }
+ User.current = @user #?
+ render :json => { :B => session[:handshake].bb.to_s(16), :salt => @user.password_salt }
rescue RECORD_NOT_FOUND
render :json => {:errors => {:login => ["unknown user"]}}
end
@@ -18,6 +18,7 @@ class SessionsController < ApplicationController
@user = User.find_by_param(params[:id])
@server_auth = @user.authenticate!(params[:client_auth].hex, session.delete(:handshake))
session[:user_id] = @user.id
+ User.current = @user #?
render :json => {:M2 => @server_auth}
rescue WRONG_PASSWORD
session[:handshake] = nil
@@ -26,6 +27,7 @@ class SessionsController < ApplicationController
def destroy
session[:user_id] = nil
+ User.current = nil #?
redirect_to root_path
end
end