Class: Hello::Business::Management::ForgotPassword

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#alert_message, #error_message, #errors, #t

Constructor Details

#initialize(attrs = nil) ⇒ ForgotPassword

Returns a new instance of ForgotPassword.



8
9
10
11
12
13
# File 'lib/hello/business/management/forgot_password.rb', line 8

def initialize(attrs = nil)
  if attrs
    @login = attrs[:login]
    @user = find_user
  end
end

Instance Attribute Details

#loginObject

Returns the value of attribute login.



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

def 
  @login
end

#userObject (readonly)

Returns the value of attribute user.



6
7
8
# File 'lib/hello/business/management/forgot_password.rb', line 6

def user
  @user
end

Instance Method Details

#email?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/hello/business/management/forgot_password.rb', line 24

def email?
  .to_s.include? '@'
end

#resetObject



15
16
17
18
19
20
21
22
# File 'lib/hello/business/management/forgot_password.rb', line 15

def reset
  if user.present?
    true
  else
    errors.add(:login, 'was not found')
    false
  end
end

#success_message(_extra = {}) ⇒ Object



28
29
30
# File 'lib/hello/business/management/forgot_password.rb', line 28

def success_message(_extra = {})
  super(login: @login)
end