Class User
In: app/models/user.rb
Parent: ActiveRecord::Base

Methods

Attributes

password_confirmation  [RW] 

Public Class methods

[Source]

    # File app/models/user.rb, line 31
31:   def self.authenticate(email, password)
32:     user = self.find_by_email(email)
33:     if user && user.is_activated
34:       expected_password = User.encrypted_password(password, user.salt)
35:       if user.hashed_password != expected_password
36:         user = nil
37:       end
38:     else
39:       user = nil
40:     end
41:     user
42:   end

Public Instance methods

[Source]

    # File app/models/user.rb, line 44
44:   def activate(activation)
45:     if self.activation == activation
46:       self.is_activated = true
47:       self.save
48:     end
49:   end

[Source]

    # File app/models/user.rb, line 20
20:   def password
21:     @password
22:   end

[Source]

    # File app/models/user.rb, line 24
24:   def password=(a_password)
25:     @password = a_password
26:     return if a_password.blank?
27:     create_new_salt
28:     self.hashed_password = User.encrypted_password(self.password, self.salt)
29:   end

[Source]

    # File app/models/user.rb, line 16
16:   def validate
17:       errors.add_to_base("Missing password") if hashed_password.blank?
18:   end

[Validate]