1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/lib/devise/models/perishable.rb
2009-09-20 10:35:26 -03:00

24 lines
574 B
Ruby

module Devise
module Perishable
def self.included(base)
base.class_eval do
# extend ClassMethods
before_create :reset_perishable_token
end
end
# Generates a new random token for confirmation, based on actual Time and salt
#
def reset_perishable_token
self.perishable_token = secure_digest(Time.now.utc, random_string, password)
end
# Resets the perishable token with and save the record without validating
#
def reset_perishable_token!
reset_perishable_token and save(false)
end
end
end