summaryrefslogtreecommitdiff
path: root/users/lib/warden
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2013-02-07 20:12:00 +0100
committerAzul <azul@leap.se>2013-02-07 20:12:00 +0100
commit5df0631c6ee7f073c4e463d3c1d12bbaeb4fc39a (patch)
tree986a65ded26e48a002b783b1048bdff07ffd0917 /users/lib/warden
parent0362663decaa1c861b183ec3773f69952398a976 (diff)
parent40955e06c038ad3d84bfe88052c501fb7a6208d8 (diff)
Merge branch 'master' into feature/use-couchrest-session-store
Diffstat (limited to 'users/lib/warden')
-rw-r--r--users/lib/warden/strategies/secure_remote_password.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/users/lib/warden/strategies/secure_remote_password.rb b/users/lib/warden/strategies/secure_remote_password.rb
index 594e27e..483336d 100644
--- a/users/lib/warden/strategies/secure_remote_password.rb
+++ b/users/lib/warden/strategies/secure_remote_password.rb
@@ -25,13 +25,18 @@ module Warden
end
def validate!
- user = session[:handshake].authenticate(params['client_auth'].hex)
- user ? success!(user) : fail!(:password => "wrong_password")
+ client = session[:handshake].authenticate(params['client_auth'].hex)
+ client ?
+ success!(User.find_by_login(client.username)) :
+ fail!(:password => "wrong_password")
end
def initialize!
if user = User.find_by_login(id)
- session[:handshake] = user.initialize_auth(params['A'].hex)
+ client = SRP::Client.new user.username,
+ :verifier => user.verifier,
+ :salt => user.salt
+ session[:handshake] = SRP::Session.new(client, params['A'].hex)
custom! json_response(session[:handshake])
else
fail! :login => "user_not_found"