From e55ff681bcc5a6c479530d1411a3da75912d78e5 Mon Sep 17 00:00:00 2001 From: Azul Date: Thu, 28 Jun 2012 16:13:13 +0200 Subject: complete ajax flow is working - just auth fails Also we currently generate the salt on the server - this should happen on the client but for now i stick to the srp-js workflow. --- example/models/user.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'example/models') diff --git a/example/models/user.rb b/example/models/user.rb index 3ad8147..af92300 100644 --- a/example/models/user.rb +++ b/example/models/user.rb @@ -5,17 +5,21 @@ class User @current ||= User.new end + def self.current=(user) + @current = user + end + attr_accessor :login attr_accessor :salt attr_accessor :verifier attr_accessor :active attr_accessor :srp - def signup!(params) - self.login = params.delete('login') - self.salt = params.delete('salt').to_i - self.verifier = params.delete('verifier').to_i + def initialize(login) + self.login = login + self.salt = OpenSSL::Random.random_bytes(10).unpack("H*")[0] self.active = false + User.current = self end def initialize_auth(params) -- cgit v1.2.3