Class: Hello::Business::Management::ForgotPassword
- Defined in:
- lib/hello/business/management/forgot_password.rb
Instance Attribute Summary collapse
-
#login ⇒ Object
Returns the value of attribute login.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #email? ⇒ Boolean
-
#initialize(attrs = nil) ⇒ ForgotPassword
constructor
A new instance of ForgotPassword.
- #reset ⇒ Object
- #success_message(_extra = {}) ⇒ Object
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
#login ⇒ Object
Returns the value of attribute login.
5 6 7 |
# File 'lib/hello/business/management/forgot_password.rb', line 5 def login @login end |
#user ⇒ Object (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
24 25 26 |
# File 'lib/hello/business/management/forgot_password.rb', line 24 def email? login.to_s.include? '@' end |
#reset ⇒ Object
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 (_extra = {}) super(login: @login) end |