mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Merge branch 'master' into rails4
This commit is contained in:
commit
f75352a373
9 changed files with 34 additions and 6 deletions
9
.yardopts
Normal file
9
.yardopts
Normal file
|
@ -0,0 +1,9 @@
|
|||
--protected
|
||||
--no-private
|
||||
--embed-mixin ClassMethods
|
||||
-
|
||||
README.md
|
||||
CHANGELOG.rdoc
|
||||
CONTRIBUTING.md
|
||||
MIT-LICENSE
|
||||
|
|
@ -45,4 +45,3 @@ class Devise::SessionsController < DeviseController
|
|||
{ :scope => resource_name, :recall => "#{controller_path}#new" }
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
|
||||
<h3>Cancel my account</h3>
|
||||
|
||||
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.</p>
|
||||
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %></p>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
|
|
|
@ -54,8 +54,9 @@ module Devise
|
|||
end
|
||||
|
||||
def mailer_sender(mapping, sender = :from)
|
||||
if default_params[sender].present?
|
||||
default_params[sender]
|
||||
default_sender = default_params[sender]
|
||||
if default_sender.present?
|
||||
default_sender.respond_to?(:to_proc) ? instance_eval(&default_sender) : default_sender
|
||||
elsif Devise.mailer_sender.is_a?(Proc)
|
||||
Devise.mailer_sender.call(mapping.name)
|
||||
else
|
||||
|
|
|
@ -22,6 +22,6 @@
|
|||
|
||||
<h3>Cancel my account</h3>
|
||||
|
||||
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.</p>
|
||||
<p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %></p>
|
||||
|
||||
<%= link_to "Back", :back %>
|
||||
|
|
|
@ -46,6 +46,11 @@ class ConfirmationInstructionsTest < ActionMailer::TestCase
|
|||
assert_equal ['custom@example.com'], mail.from
|
||||
end
|
||||
|
||||
test 'setup sender from custom mailer defaults with proc' do
|
||||
Devise.mailer = 'Users::FromProcMailer'
|
||||
assert_equal ['custom@example.com'], mail.from
|
||||
end
|
||||
|
||||
test 'custom mailer renders parent mailer template' do
|
||||
Devise.mailer = 'Users::Mailer'
|
||||
assert_not_blank mail.body.encoded
|
||||
|
|
|
@ -48,6 +48,11 @@ class ResetPasswordInstructionsTest < ActionMailer::TestCase
|
|||
assert_equal ['custom@example.com'], mail.from
|
||||
end
|
||||
|
||||
test 'setup sender from custom mailer defaults with proc' do
|
||||
Devise.mailer = 'Users::FromProcMailer'
|
||||
assert_equal ['custom@example.com'], mail.from
|
||||
end
|
||||
|
||||
test 'custom mailer renders parent mailer template' do
|
||||
Devise.mailer = 'Users::Mailer'
|
||||
assert_not_blank mail.body.encoded
|
||||
|
|
|
@ -49,6 +49,11 @@ class UnlockInstructionsTest < ActionMailer::TestCase
|
|||
assert_equal ['custom@example.com'], mail.from
|
||||
end
|
||||
|
||||
test 'setup sender from custom mailer defaults with proc' do
|
||||
Devise.mailer = 'Users::FromProcMailer'
|
||||
assert_equal ['custom@example.com'], mail.from
|
||||
end
|
||||
|
||||
test 'custom mailer renders parent mailer template' do
|
||||
Devise.mailer = 'Users::Mailer'
|
||||
assert_not_blank mail.body.encoded
|
||||
|
|
|
@ -5,4 +5,8 @@ end
|
|||
class Users::ReplyToMailer < Devise::Mailer
|
||||
default :from => 'custom@example.com'
|
||||
default :reply_to => 'custom_reply_to@example.com'
|
||||
end
|
||||
end
|
||||
|
||||
class Users::FromProcMailer < Devise::Mailer
|
||||
default :from => proc { 'custom@example.com' }
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue