lib/rhosync/user.rb in rhosync-2.0.9 vs lib/rhosync/user.rb in rhosync-2.1.0.beta.1

- old
+ new

@@ -9,14 +9,19 @@ field :salt,:string field :hashed_password,:string set :clients, :string field :admin, :int field :token_id, :string - + class << self def create(fields={}) fields[:id] = fields[:login] + if Rhosync.stats + Rhosync::Stats::Record.set('users') { Store.incr('user:count') } + else + Store.incr('user:count') + end super(fields) end def authenticate(login,password) return unless is_exist?(login) @@ -39,9 +44,14 @@ def delete clients.members.each do |client_id| Client.load(client_id,{:source_name => '*'}).delete end self.token.delete if self.token + if Rhosync.stats + Rhosync::Stats::Record.set('users') { Store.decr('user:count') } + else + Store.decr('user:count') + end super end def create_token if self.token_id && ApiToken.is_exist?(self.token_id) \ No newline at end of file