From e9c82472ffe7c43a448945f77e034a0e47dde0bb Mon Sep 17 00:00:00 2001 From: Jon Phenow Date: Wed, 24 Jun 2015 10:50:43 -0500 Subject: [PATCH] quick comment touch-ups --- app/mailers/devise/mailer.rb | 2 +- app/views/devise/mailer/password_change.html.erb | 2 +- lib/devise.rb | 2 +- lib/generators/templates/devise.rb | 2 +- lib/generators/templates/markerb/password_change.markerb | 2 +- test/models/database_authenticatable_test.rb | 9 +++++---- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/app/mailers/devise/mailer.rb b/app/mailers/devise/mailer.rb index efb0bba5..555b64d2 100644 --- a/app/mailers/devise/mailer.rb +++ b/app/mailers/devise/mailer.rb @@ -18,7 +18,7 @@ if defined?(ActionMailer) end def password_change(record, opts={}) - devise_mail(record, :unlock_instructions) + devise_mail(record, :password_change, opts) end end end diff --git a/app/views/devise/mailer/password_change.html.erb b/app/views/devise/mailer/password_change.html.erb index 75751687..b41daf47 100644 --- a/app/views/devise/mailer/password_change.html.erb +++ b/app/views/devise/mailer/password_change.html.erb @@ -1,3 +1,3 @@

Hello <%= @resource.email %>!

-

We're contacting you to notify you that you're password has been changed.

+

We're contacting you to notify you that your password has been changed.

diff --git a/lib/devise.rb b/lib/devise.rb index 979479df..d1869651 100644 --- a/lib/devise.rb +++ b/lib/devise.rb @@ -150,7 +150,7 @@ module Devise mattr_accessor :pepper @@pepper = nil - # Used to encrypt password. Please generate one with rake secret. + # Used to enable sending notification to user when their password is changed mattr_accessor :send_password_change_notification @@send_password_change_notification = false diff --git a/lib/generators/templates/devise.rb b/lib/generators/templates/devise.rb index 80a5e38c..42720aa5 100644 --- a/lib/generators/templates/devise.rb +++ b/lib/generators/templates/devise.rb @@ -105,7 +105,7 @@ Devise.setup do |config| # Setup a pepper to generate the encrypted password. # config.pepper = '<%= SecureRandom.hex(64) %>' - # Send a notification email on password change + # Send a notification email when the user's password is changed # config.send_password_change_notification = false # ==> Configuration for :confirmable diff --git a/lib/generators/templates/markerb/password_change.markerb b/lib/generators/templates/markerb/password_change.markerb index 75751687..b41daf47 100644 --- a/lib/generators/templates/markerb/password_change.markerb +++ b/lib/generators/templates/markerb/password_change.markerb @@ -1,3 +1,3 @@

Hello <%= @resource.email %>!

-

We're contacting you to notify you that you're password has been changed.

+

We're contacting you to notify you that your password has been changed.

diff --git a/test/models/database_authenticatable_test.rb b/test/models/database_authenticatable_test.rb index ad7f5dd7..5daca424 100644 --- a/test/models/database_authenticatable_test.rb +++ b/test/models/database_authenticatable_test.rb @@ -237,10 +237,11 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase end test 'should email on password change when configured' do - User.stubs(:send_password_change_notification).returns(true) - user = create_user - assert_email_sent user.email do - assert user.update_attributes(password: 'newpass', password_confirmation: 'newpass') + swap Devise, send_password_change_notification: true do + user = create_user + assert_email_sent user.email do + assert user.update_attributes(password: 'newpass', password_confirmation: 'newpass') + end end end