Module: Mori::User

Extended by:
ActiveSupport::Concern
Included in:
User
Defined in:
lib/mori/user.rb

Defined Under Namespace

Modules: Callbacks, ClassMethods, Validations

Instance Method Summary collapse

Instance Method Details

#accept_invitation(password) ⇒ Object



61
62
63
64
65
# File 'lib/mori/user.rb', line 61

def accept_invitation(password)
  self.password = password
  self.confirmed = true
  self.save
end

#authenticate(password) ⇒ Object



89
90
91
# File 'lib/mori/user.rb', line 89

def authenticate(password)
  ::BCrypt::Password.new(self.password) == password
end

#change_password(new_password) ⇒ Object



67
68
69
70
# File 'lib/mori/user.rb', line 67

def change_password(new_password)
  self.password = new_password
  save
end

#confirm_emailObject



79
80
81
82
# File 'lib/mori/user.rb', line 79

def confirm_email
  self.confirmed = true
  self.save
end

#forgot_passwordObject



72
73
74
75
76
77
# File 'lib/mori/user.rb', line 72

def forgot_password
  self.password_reset_token = Token.new
  self.password_reset_sent = Date.today
  MoriMailer.forgot_password(self)
  save
end

#reset_password(new_password) ⇒ Object



84
85
86
87
# File 'lib/mori/user.rb', line 84

def reset_password(new_password)
  self.password = new_password
  self.save
end