Class: BackOffice::Password

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/back_office/password.rb

Direct Known Subclasses

Reset

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#emailObject

Returns the value of attribute email.



5
6
7
# File 'lib/back_office/password.rb', line 5

def email
  @email
end

#plaintextObject

Returns the value of attribute plaintext.



5
6
7
# File 'lib/back_office/password.rb', line 5

def plaintext
  @plaintext
end

#plaintext_confirmationObject

Returns the value of attribute plaintext_confirmation.



5
6
7
# File 'lib/back_office/password.rb', line 5

def plaintext_confirmation
  @plaintext_confirmation
end

Instance Method Details

#update(attrs) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/back_office/password.rb', line 9

def update(attrs)
  self.plaintext              = attrs[:plaintext]
  self.plaintext_confirmation = attrs[:plaintext_confirmation]

  if valid?(:update)
    user.update(password: plaintext)
    true
  end
end

#userObject



19
20
21
# File 'lib/back_office/password.rb', line 19

def user
  User.find_by(email: email) if email
end