Sha256: e9ae319b45c240871304334214f3a59a5c9d77924fa9211f0afbe83a30d42b16
Contents?: true
Size: 306 Bytes
Versions: 3
Compression:
Stored size: 306 Bytes
Contents
User.class_eval do def clear_api_key! self.update_attribute(:api_key, "") end def generate_api_key! self.update_attribute(:api_key, secure_digest(Time.now, (1..10).map{ rand.to_s })) end private def secure_digest(*args) Digest::SHA1.hexdigest(args.flatten.join('--')) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spree_api-0.30.2 | app/models/user_decorator.rb |
spree_api-0.30.1 | app/models/user_decorator.rb |
spree_api-0.30.0 | app/models/user_decorator.rb |