summaryrefslogtreecommitdiff
path: root/users/app/controllers
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-10-11 17:11:32 +0200
committerAzul <azul@leap.se>2012-10-11 17:11:32 +0200
commit0c79df9874c59fbaa5c845e07d8fa1b4bbc23b9c (patch)
treee470ec9050e43a94d9e24a8101d30d43886740bd /users/app/controllers
parent09003d3d2df7c250d3a0b55e83094e5e27094859 (diff)
use ruby-srp 0.1.3 which returns the user on authenticate call
Also removed a few hooks to User.current. Will replace with current_user
Diffstat (limited to 'users/app/controllers')
-rw-r--r--users/app/controllers/sessions_controller.rb7
1 files changed, 1 insertions, 6 deletions
diff --git a/users/app/controllers/sessions_controller.rb b/users/app/controllers/sessions_controller.rb
index 284c0e2..4a1107d 100644
--- a/users/app/controllers/sessions_controller.rb
+++ b/users/app/controllers/sessions_controller.rb
@@ -8,19 +8,15 @@ class SessionsController < ApplicationController
def create
@user = User.find_by_param(params[:login])
session[:handshake] = @user.initialize_auth(params['A'].hex)
- User.current = @user #?
render :json => session[:handshake]
rescue RECORD_NOT_FOUND
render :json => {:errors => {:login => ["unknown user"]}}
end
def update
- # TODO: validate the id belongs to the session
- @user = User.find_by_param(params[:id])
@srp_session = session.delete(:handshake)
- @srp_session.authenticate!(params[:client_auth].hex)
+ @user = @srp_session.authenticate!(params[:client_auth].hex)
session[:user_id] = @user.id
- User.current = @user #?
render :json => @srp_session
rescue WRONG_PASSWORD
session[:handshake] = nil
@@ -29,7 +25,6 @@ class SessionsController < ApplicationController
def destroy
session[:user_id] = nil
- User.current = nil #?
redirect_to root_path
end
end