Class: Spree::UserMailer

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

Instance Method Summary collapse

Instance Method Details

#confirmation_instructions(user, token, _opts = {}) ⇒ Object



13
14
15
16
17
18
# File 'app/mailers/spree/user_mailer.rb', line 13

def confirmation_instructions(user, token, _opts = {})
  @confirmation_url = spree.spree_user_confirmation_url(confirmation_token: token, host: Spree::Store.current.url)
  @email = user.email

  mail to: user.email, from: from_address, subject: Spree::Store.current.name + ' ' + I18n.t(:subject, scope: [:devise, :mailer, :confirmation_instructions])
end

#reset_password_instructions(user, token, *_args) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'app/mailers/spree/user_mailer.rb', line 3

def reset_password_instructions(user, token, *_args)
  current_store_id = _args.inject(:merge)[:current_store_id]
  @current_store = Spree::Store.find(current_store_id) || Spree::Store.current
  @locale = @current_store.has_attribute?(:default_locale) ? @current_store.default_locale : I18n.default_locale
  I18n.locale = @locale if @locale.present?
  @edit_password_reset_url = spree.edit_spree_user_password_url(reset_password_token: token, host: @current_store.url)

  mail to: user.email, from: from_address, subject: @current_store.name + ' ' + I18n.t(:subject, scope: [:devise, :mailer, :reset_password_instructions])
end