class Hello::Business::Management::ResetPassword

Attributes

password_credential[R]

Public Class Methods

new(password_credential) click to toggle source
# File lib/hello/business/management/reset_password.rb, line 7
def initialize(password_credential)
  @password_credential = password_credential
end

Public Instance Methods

update_password(plain_text_password) click to toggle source
# 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
user() click to toggle source
# File lib/hello/business/management/reset_password.rb, line 21
def user
  password_credential.user
end

Private Instance Methods

merge_errors_to_self() click to toggle source
# File lib/hello/business/management/reset_password.rb, line 27
def merge_errors_to_self
  hash = @password_credential.errors.to_hash
  hash.each { |k, v| v.each { |v1| errors.add(k, v1) } }
end