Module: Concerns::ModelActivation::ClassMethods
- Defined in:
- app/models/pillowfort/concerns/model_activation.rb
Instance Method Summary collapse
Methods included from Pillowfort::ModelFinder
#find_by_email_case_insensitive
Methods included from Pillowfort::TokenGenerator
#friendly_token, #secure_compare
Instance Method Details
#find_and_activate(email, token) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'app/models/pillowfort/concerns/model_activation.rb', line 78 def find_and_activate(email, token) return false if email.blank? || token.blank? transaction do resource = find_by_email_case_insensitive(email) if resource if resource.activation_token_expired? return false else if secure_compare(resource.activation_token, token) resource.activate! yield resource if block_given? resource end end end end end |