Sha256: bee0dc3accfd786b7e906c88c5b9caf48f961c69197a5a3eff0b990d7a852395
Contents?: true
Size: 850 Bytes
Versions: 4
Compression:
Stored size: 850 Bytes
Contents
module RailsBase::Authentication class SendForgotPassword < RailsBase::ServiceBase delegate :email, to: :context 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.message}") context.fail!(message: email_send.message, redirect_url: '/') end context.message = 'You should receive an email shortly.' end def validate! raise "Expected email to be a String. Received #{email.class}" unless email.is_a? String end end end
Version data entries
4 entries across 4 versions & 1 rubygems