summaryrefslogtreecommitdiff
path: root/users/app
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-10-30 12:32:10 +0100
committerAzul <azul@leap.se>2012-10-30 12:32:10 +0100
commit194e924cb7c36eafa01b68c74774505e170e47ac (patch)
treed6f655010c2cc25b31e1b95b2cef78c962f9c84f /users/app
parent3ba2e664a26e96a93c8640b57241af6386db361e (diff)
adding in warden with a basic strategy
currently failing because we are not setting the content-type header.
Diffstat (limited to 'users/app')
-rw-r--r--users/app/controllers/application_controller.rb2
-rw-r--r--users/app/controllers/sessions_controller.rb16
2 files changed, 5 insertions, 13 deletions
diff --git a/users/app/controllers/application_controller.rb b/users/app/controllers/application_controller.rb
index 64e1a55..8388dda 100644
--- a/users/app/controllers/application_controller.rb
+++ b/users/app/controllers/application_controller.rb
@@ -4,7 +4,7 @@ class ApplicationController < ActionController::Base
private
def current_user
- @current_user ||= User.find(session[:user_id]) if session[:user_id]
+ @current_user ||= env['warden'].user
end
helper_method :current_user
diff --git a/users/app/controllers/sessions_controller.rb b/users/app/controllers/sessions_controller.rb
index 4a1107d..3872866 100644
--- a/users/app/controllers/sessions_controller.rb
+++ b/users/app/controllers/sessions_controller.rb
@@ -6,21 +6,13 @@ class SessionsController < ApplicationController
end
def create
- @user = User.find_by_param(params[:login])
- session[:handshake] = @user.initialize_auth(params['A'].hex)
- render :json => session[:handshake]
- rescue RECORD_NOT_FOUND
- render :json => {:errors => {:login => ["unknown user"]}}
+ debugger
+ env['warden'].authenticate!
end
def update
- @srp_session = session.delete(:handshake)
- @user = @srp_session.authenticate!(params[:client_auth].hex)
- session[:user_id] = @user.id
- render :json => @srp_session
- rescue WRONG_PASSWORD
- session[:handshake] = nil
- render :json => {:errors => {"password" => ["wrong password"]}}
+ debugger
+ env['warden'].authenticate!
end
def destroy