Class: Spree::CustomerMailer

Inherits:
BaseMailer
  • Object
show all
Defined in:
app/mailers/spree/customer_mailer.rb

Instance Method Summary collapse

Instance Method Details

#password_reset_email(user, reset_token, store, redirect_url: nil) ⇒ Object

Password reset requested through the Store API (customer.password_reset_requested). The link goes to the validated redirect URL when the storefront supplied one, falling back to the store's storefront URL, with the reset token appended.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/mailers/spree/customer_mailer.rb', line 6

def password_reset_email(user, reset_token, store, redirect_url: nil)
  @user = user
  @current_store = store
  base_url = redirect_url.presence || store.storefront_url
  @reset_url = append_token(base_url, reset_token)

  with_store_locale(store) do
    mail(
      to: user.email,
      subject: "#{store.name} #{Spree.t('customer_mailer.password_reset_email.subject')}",
      store_url: store.storefront_url
    )
  end
end