]> source.dussan.org Git - redmine.git/commitdiff
Let the mailer set the email content (#21421).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 20 Mar 2016 07:35:08 +0000 (07:35 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 20 Mar 2016 07:35:08 +0000 (07:35 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15267 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/account_controller.rb
app/controllers/my_controller.rb
app/models/mailer.rb

index da0d5586d50e082be922009ffc7b769333b332d0..7101d17bed63e65368ce12ab9a86731f5257a584 100644 (file)
@@ -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
index 3acd92658a61cf4f4afc0d04f1473d2dcbb63522..15ec0892a5e59691681c99a5c25b22e376166620 100644 (file)
@@ -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
index ac86e6a71379518e1f78742b4b6b5cb9df1659e9..bd242004082b3685b76c8d305b9a4cf95ea6ecea 100644 (file)
@@ -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