Class: Hello::Business::Management::ResetPassword

Inherits:
Base
  • Object
show all
Defined in:
lib/hello/business/management/reset_password.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#alert_message, #error_message, #errors, #success_message, #t

Constructor Details

#initialize(password_credential) ⇒ ResetPassword

Returns a new instance of ResetPassword.



7
8
9
# File 'lib/hello/business/management/reset_password.rb', line 7

def initialize(password_credential)
  @password_credential = password_credential
end

Instance Attribute Details

#password_credentialObject (readonly)

Returns the value of attribute password_credential.



5
6
7
# File 'lib/hello/business/management/reset_password.rb', line 5

def password_credential
  @password_credential
end

Instance Method Details

#update_password(plain_text_password) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/hello/business/management/reset_password.rb', line 11

def update_password(plain_text_password)
  if @password_credential.update(password: plain_text_password)
    @password_credential.reset_verifying_token!
    return true
  else
    merge_errors_to_self
    return false
  end
end

#userObject



21
22
23
# File 'lib/hello/business/management/reset_password.rb', line 21

def user
  password_credential.user
end