Module: Sorcery::Model::Submodules::UserActivation::InstanceMethods
- Defined in:
- lib/sorcery/model/submodules/user_activation.rb
Instance Attribute Summary collapse
-
#skip_activation_needed_email ⇒ Object
Returns the value of attribute skip_activation_needed_email.
-
#skip_activation_success_email ⇒ Object
Returns the value of attribute skip_activation_success_email.
Instance Method Summary collapse
-
#activate! ⇒ Object
clears activation code, sets the user as ‘active’ and optionaly sends a success email.
- #setup_activation ⇒ Object
Instance Attribute Details
#skip_activation_needed_email ⇒ Object
Returns the value of attribute skip_activation_needed_email.
107 108 109 |
# File 'lib/sorcery/model/submodules/user_activation.rb', line 107 def skip_activation_needed_email @skip_activation_needed_email end |
#skip_activation_success_email ⇒ Object
Returns the value of attribute skip_activation_success_email.
107 108 109 |
# File 'lib/sorcery/model/submodules/user_activation.rb', line 107 def skip_activation_success_email @skip_activation_success_email end |
Instance Method Details
#activate! ⇒ Object
clears activation code, sets the user as ‘active’ and optionaly sends a success email.
99 100 101 102 103 104 105 |
# File 'lib/sorcery/model/submodules/user_activation.rb', line 99 def activate! config = sorcery_config send(:"#{config.activation_token_attribute_name}=", nil) send(:"#{config.activation_state_attribute_name}=", 'active') send_activation_success_email! if send_activation_success_email? sorcery_adapter.save(validate: false, raise_on_failure: true) end |
#setup_activation ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/sorcery/model/submodules/user_activation.rb', line 90 def setup_activation config = sorcery_config generated_activation_token = TemporaryToken.generate_random_token send(:"#{config.activation_token_attribute_name}=", generated_activation_token) send(:"#{config.activation_state_attribute_name}=", 'pending') send(:"#{config.activation_token_expires_at_attribute_name}=", Time.now.in_time_zone + config.activation_token_expiration_period) if config.activation_token_expiration_period end |