Class: RailsBase::Authentication::SendForgotPassword
- Inherits:
-
ServiceBase
- Object
- ServiceBase
- RailsBase::Authentication::SendForgotPassword
- Defined in:
- app/services/rails_base/authentication/send_forgot_password.rb
Instance Method Summary collapse
Methods inherited from ServiceBase
inherited, #internal_validate, #service_base_logging
Methods included from ServiceLogging
#aletered_message, #class_name, #log, #log_prefix, #logger, #service_id
Instance Method Details
#call ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/services/rails_base/authentication/send_forgot_password.rb', line 5 def call user = User.find_for_authentication(email: email) if user.nil? log(level: :warn, msg: "Failed to find email assocaited to #{email}. Not sending email") context.fail!(message: "Failed to send forget password to #{email}", redirect_url: '') end email_send = SendVerificationEmail.call(user: user, reason: Constants::VFP_REASON) if email_send.failure? log(level: :error, msg: "Failed to send forget password: #{email_send.}") context.fail!(message: email_send., redirect_url: '/') end context. = 'You should receive an email shortly.' end |
#validate! ⇒ Object
22 23 24 |
# File 'app/services/rails_base/authentication/send_forgot_password.rb', line 22 def validate! raise "Expected email to be a String. Received #{email.class}" unless email.is_a? String end |