From a47eab8868350fa0fbecfda817560b5d8c745f9a Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 20 Mar 2016 07:35:08 +0000 Subject: [PATCH] Let the mailer set the email content (#21421). git-svn-id: http://svn.redmine.org/redmine/trunk@15267 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/account_controller.rb | 7 +------ app/controllers/my_controller.rb | 7 +------ 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 -- 2.39.5