2017-07-16 13:11:16 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2010-12-18 16:38:05 -05:00
|
|
|
class User
|
2012-05-08 18:54:47 -04:00
|
|
|
extend ActiveModel::Callbacks
|
2010-12-18 16:38:05 -05:00
|
|
|
include ActiveModel::SecurePassword
|
2016-08-06 13:55:02 -04:00
|
|
|
|
2012-05-08 18:54:47 -04:00
|
|
|
define_model_callbacks :create
|
2010-12-18 16:38:05 -05:00
|
|
|
|
|
|
|
has_secure_password
|
2018-07-08 06:56:07 -04:00
|
|
|
has_secure_password :recovery_password, validations: false
|
2010-12-18 16:38:05 -05:00
|
|
|
|
2018-07-08 06:56:07 -04:00
|
|
|
attr_accessor :password_digest, :recovery_password_digest
|
2019-04-04 12:43:41 -04:00
|
|
|
attr_accessor :password_called
|
|
|
|
|
|
|
|
def password=(unencrypted_password)
|
|
|
|
self.password_called ||= 0
|
|
|
|
self.password_called += 1
|
|
|
|
super
|
|
|
|
end
|
2010-12-18 16:38:05 -05:00
|
|
|
end
|