Module: ActiveRecord::ActsAsAuthenticatable::InstanceMethods
- Defined in:
- lib/active_record/acts_as_authenticatable.rb
Instance Method Summary collapse
- #activate ⇒ Object
- #create_remember_me_token ⇒ Object
- #deactivate ⇒ Object
-
#new_password ⇒ Object
New password attribute (used when editing a user).
- #new_password=(pwd) ⇒ Object
-
#password ⇒ Object
Password attribute (used when creating a user).
- #password=(pwd) ⇒ Object
- #username=(username) ⇒ Object
Instance Method Details
#activate ⇒ Object
82 83 84 |
# File 'lib/active_record/acts_as_authenticatable.rb', line 82 def activate self.update_attribute :active, true end |
#create_remember_me_token ⇒ Object
90 91 92 93 94 |
# File 'lib/active_record/acts_as_authenticatable.rb', line 90 def create_remember_me_token pass_to_hash=Time.now.to_i.to_s + "Securasaurus" + password_seed self.update_attribute :remember_me_token, Digest::SHA1.hexdigest(pass_to_hash) self.remember_me_token end |
#deactivate ⇒ Object
86 87 88 |
# File 'lib/active_record/acts_as_authenticatable.rb', line 86 def deactivate self.update_attribute :active, false end |
#new_password ⇒ Object
New password attribute (used when editing a user)
71 72 73 |
# File 'lib/active_record/acts_as_authenticatable.rb', line 71 def new_password return @new_password end |
#new_password=(pwd) ⇒ Object
75 76 77 78 79 80 |
# File 'lib/active_record/acts_as_authenticatable.rb', line 75 def new_password=(pwd) @new_password = pwd return if pwd.blank? create_salt self.hashed_password = self.class.encrypt_password(@new_password, self.password_seed) end |
#password ⇒ Object
Password attribute (used when creating a user)
59 60 61 |
# File 'lib/active_record/acts_as_authenticatable.rb', line 59 def password return @password end |
#password=(pwd) ⇒ Object
63 64 65 66 67 68 |
# File 'lib/active_record/acts_as_authenticatable.rb', line 63 def password=(pwd) @password = pwd return if pwd.blank? create_salt self.hashed_password = self.class.encrypt_password(@password, self.password_seed) end |
#username=(username) ⇒ Object
54 55 56 |
# File 'lib/active_record/acts_as_authenticatable.rb', line 54 def username=(username) super(username.downcase) end |