-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use emails only when spree_emails is available (#556)
* Use emails only when spree_emails is available * fix
- Loading branch information
1 parent
27a451a
commit 7fe5424
Showing
9 changed files
with
36 additions
and
25 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
config.mailer_sender = '[email protected]' | ||
|
||
# Configure the class responsible to send e-mails. | ||
config.mailer = 'Spree::UserMailer' | ||
config.mailer = 'Spree::UserMailer' if defined?(Spree::Emails) | ||
|
||
# ==> ORM configuration | ||
# Load and configure the ORM. Supports :active_record (default) and | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module Spree | ||
class UserMailer < BaseMailer | ||
def reset_password_instructions(user, token, *args) | ||
current_store_id = args.inject(:merge)[:current_store_id] | ||
@current_store = Spree::Store.find_by(id: 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) | ||
@user = user | ||
|
||
mail to: user.email, from: from_address, reply_to: reply_to_address, | ||
subject: @current_store.name + ' ' + I18n.t(:subject, scope: [:devise, :mailer, :reset_password_instructions]), store_url: @current_store.url | ||
end | ||
|
||
def confirmation_instructions(user, token, opts = {}) | ||
current_store_id = opts[:current_store_id] | ||
@current_store = Spree::Store.find_by(id: current_store_id) || Spree::Store.current | ||
@confirmation_url = spree.confirmation_url(confirmation_token: token, host: @current_store.url) | ||
@email = user.email | ||
|
||
mail to: user.email, from: from_address, reply_to: reply_to_address, | ||
subject: @current_store.name + ' ' + I18n.t(:subject, scope: [:devise, :mailer, :confirmation_instructions]), store_url: @current_store.url | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters