diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-03-20 07:35:08 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-03-20 07:35:08 +0000 |
commit | a47eab8868350fa0fbecfda817560b5d8c745f9a (patch) | |
tree | 8a585ea31758e8628b719826e879a061566f3cf3 | |
parent | 46a4151f09359c9c64a2073d20c0267d64cdb516 (diff) | |
download | redmine-a47eab8868350fa0fbecfda817560b5d8c745f9a.tar.gz redmine-a47eab8868350fa0fbecfda817560b5d8c745f9a.zip |
Let the mailer set the email content (#21421).
git-svn-id: http://svn.redmine.org/redmine/trunk@15267 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/controllers/account_controller.rb | 7 | ||||
-rw-r--r-- | app/controllers/my_controller.rb | 7 | ||||
-rw-r--r-- | app/models/mailer.rb | 10 |
3 files changed, 12 insertions, 12 deletions
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index da0d5586d..7101d17be 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -73,12 +73,7 @@ class AccountController < ApplicationController @user.password, @user.password_confirmation = params[:new_password], params[:new_password_confirmation] if @user.save @token.destroy - Mailer.security_notification(@user, - message: :mail_body_security_notification_change, - field: :field_password, - title: :button_change_password, - url: {controller: 'my', action: 'password'} - ).deliver + Mailer.password_updated(@user) flash[:notice] = l(:notice_account_password_updated) redirect_to signin_path return diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index 3acd92658..15ec0892a 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -105,12 +105,7 @@ class MyController < ApplicationController if @user.save # The session token was destroyed by the password change, generate a new one session[:tk] = @user.generate_session_token - Mailer.security_notification(@user, - message: :mail_body_security_notification_change, - field: :field_password, - title: :button_change_password, - url: {controller: 'my', action: 'password'} - ).deliver + Mailer.password_updated(@user) flash[:notice] = l(:notice_account_password_updated) redirect_to my_account_path end diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ac86e6a71..bd2420040 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -310,6 +310,16 @@ class Mailer < ActionMailer::Base :subject => l(:mail_subject_lost_password, Setting.app_title) end + # Notifies user that his password was updated + def self.password_updated(user) + Mailer.security_notification(user, + message: :mail_body_security_notification_change, + field: :field_password, + title: :button_change_password, + url: {controller: 'my', action: 'password'} + ).deliver + end + def register(token) set_language_if_valid(token.user.language) @token = token |