diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-07-23 11:26:04 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-07-23 11:26:04 +0000 |
commit | d74f0bfd5c53962e332c2dd4d30dafaa1105b92b (patch) | |
tree | f3eaf66d67c3a87fb34340561bf188d364de623c /app/models/email_address.rb | |
parent | 41bb302594b48152b87c92f196c915f499093bbf (diff) | |
download | redmine-d74f0bfd5c53962e332c2dd4d30dafaa1105b92b.tar.gz redmine-d74f0bfd5c53962e332c2dd4d30dafaa1105b92b.zip |
Merged rails-5.1 branch (#23630).
git-svn-id: http://svn.redmine.org/redmine/trunk@16859 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/email_address.rb')
-rw-r--r-- | app/models/email_address.rb | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/models/email_address.rb b/app/models/email_address.rb index 295b9bcaa..d144e2f88 100644 --- a/app/models/email_address.rb +++ b/app/models/email_address.rb @@ -19,7 +19,6 @@ class EmailAddress < ActiveRecord::Base include Redmine::SafeAttributes belongs_to :user - attr_protected :id after_create :deliver_security_notification_create after_update :destroy_tokens, :deliver_security_notification_update @@ -63,17 +62,17 @@ class EmailAddress < ActiveRecord::Base # send a security notification to user that an email has been changed (notified/not notified) def deliver_security_notification_update - if address_changed? - recipients = [user, address_was] + if saved_change_to_address? + recipients = [user, address_before_last_save] options = { message: :mail_body_security_notification_change_to, field: :field_mail, value: address } - elsif notify_changed? + elsif saved_change_to_notify? recipients = [user, address] options = { - message: notify_was ? :mail_body_security_notification_notify_disabled : :mail_body_security_notification_notify_enabled, + message: notify_before_last_save ? :mail_body_security_notification_notify_disabled : :mail_body_security_notification_notify_enabled, value: address } end @@ -103,7 +102,7 @@ class EmailAddress < ActiveRecord::Base # This helps to keep the account secure in case the associated email account # was compromised. def destroy_tokens - if address_changed? || destroyed? + if saved_change_to_address? || destroyed? tokens = ['recovery'] Token.where(:user_id => user_id, :action => tokens).delete_all end |