1
0
mirror of https://github.com/meineerde/redmine.git synced 2026-01-03 06:09:41 +00:00

Let the mailer set the email content (#21421).

git-svn-id: http://svn.redmine.org/redmine/trunk@15267 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2016-03-20 07:35:08 +00:00
parent 46a4151f09
commit a47eab8868
3 changed files with 12 additions and 12 deletions

View 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

View 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

View 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