diff options
| author | Azul <azul@leap.se> | 2012-06-28 16:13:13 +0200 | 
|---|---|---|
| committer | Azul <azul@leap.se> | 2012-06-28 16:13:13 +0200 | 
| commit | e55ff681bcc5a6c479530d1411a3da75912d78e5 (patch) | |
| tree | aca518663d05f3093520fd3b5d0449efe0b7eb84 /example/models | |
| parent | 424c80fde151d4507cd34aaf8f116016df405c8a (diff) | |
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.
Diffstat (limited to 'example/models')
| -rw-r--r-- | example/models/user.rb | 12 | 
1 files changed, 8 insertions, 4 deletions
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)  | 
