Module: Merb::Authentication::Mixins::ActivatedUser::InstanceMethods
- Defined in:
- lib/merb-auth-slice-activation/mixins/activated_user.rb
Overview
ClassMethods
Instance Method Summary collapse
-
#activate! ⇒ Object
Activates and saves the user.
-
#active? ⇒ Boolean
(also: #activated?)
Checks to see if a user is active.
-
#make_activation_code ⇒ Object
Creates and sets the activation code for the user.
-
#recently_activated? ⇒ Boolean
Checks if the user has just been activated.
-
#send_activation_notification ⇒ Object
Sends out the activation notification.
-
#send_signup_notification ⇒ Object
Sends out the signup notification.
Instance Method Details
#activate! ⇒ Object
Activates and saves the user.
52 53 54 55 56 57 58 59 |
# File 'lib/merb-auth-slice-activation/mixins/activated_user.rb', line 52 def activate! self.reload unless self.new_record? # Make sure the model is up to speed before we try to save it set_activated_data! self.save # send mail for activation send_activation_notification end |
#active? ⇒ Boolean Also known as: activated?
Checks to see if a user is active
71 72 73 74 |
# File 'lib/merb-auth-slice-activation/mixins/activated_user.rb', line 71 def active? return false if self.new_record? !! activation_code.nil? end |
#make_activation_code ⇒ Object
Creates and sets the activation code for the user.
Returns
- String
-
The activation code.
82 83 84 |
# File 'lib/merb-auth-slice-activation/mixins/activated_user.rb', line 82 def make_activation_code self.activation_code = self.class.make_key end |
#recently_activated? ⇒ Boolean
Checks if the user has just been activated. Where ‘just’ means within the current request. Note that a user can be activate, but the method returns false
!
Returns
- Boolean
-
true
is the user has been activated, otherwisefalse
.
66 67 68 |
# File 'lib/merb-auth-slice-activation/mixins/activated_user.rb', line 66 def recently_activated? @activated end |
#send_activation_notification ⇒ Object
Sends out the activation notification. Used ‘Welcome’ as subject if MaSA[:activation_subject]
is not set.
88 89 90 |
# File 'lib/merb-auth-slice-activation/mixins/activated_user.rb', line 88 def send_activation_notification deliver_activation_email(:activation, :subject => (MaSA[:welcome_subject] || "Welcome" )) end |
#send_signup_notification ⇒ Object
Sends out the signup notification. Used ‘Please Activate Your Account’ as subject if MaSA[:activation_subject]
is not set.
94 95 96 |
# File 'lib/merb-auth-slice-activation/mixins/activated_user.rb', line 94 def send_signup_notification deliver_activation_email(:signup, :subject => (MaSA[:activation_subject] || "Please Activate Your Account") ) end |