diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-02-05 07:33:24 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-02-05 07:33:24 +0000 |
commit | 5d70fce6ce4c481f058fc1b89d567c1389cb7e54 (patch) | |
tree | fe7c5a9602d73ef312b544783efb0ff645bc7f1d /app/models/mailer.rb | |
parent | 40e6a74d4834f171bd8080dce39c587d84fb86da (diff) | |
download | redmine-5d70fce6ce4c481f058fc1b89d567c1389cb7e54.tar.gz redmine-5d70fce6ce4c481f058fc1b89d567c1389cb7e54.zip |
Security notifications when password or email adress is changed (#21421).
Patch by Jan Schulz-Hofen.
git-svn-id: http://svn.redmine.org/redmine/trunk@15145 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/mailer.rb')
-rw-r--r-- | app/models/mailer.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/models/mailer.rb b/app/models/mailer.rb index ac4cc3a04..a803a35c2 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -318,6 +318,20 @@ class Mailer < ActionMailer::Base :subject => l(:mail_subject_register, Setting.app_title) end + def security_notification(recipients, options={}) + redmine_headers 'Sender' => User.current.login + @user = Array(recipients).detect{|r| r.is_a? User } + set_language_if_valid(@user.try :language) + @message = l(options[:message], + field: (options[:field] && l(options[:field])), + value: options[:value] + ) + @title = options[:title] && l(options[:title]) + @url = options[:url] && (options[:url].is_a?(Hash) ? url_for(options[:url]) : options[:url]) + mail :to => recipients, + :subject => l(:mail_subject_security_notification) + end + def test_email(user) set_language_if_valid(user.language) @url = url_for(:controller => 'welcome') |