mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
25 lines
580 B
Ruby
25 lines
580 B
Ruby
module Devise
|
|
module PerishableToken
|
|
|
|
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
|
|
|