This commit aims to notify the user (currently through an email) that some important security parameter of his account has changed. Here is a list of what is currently notified: - password change - login change - email change - 2FA enabled/disabled - trusted device (for 2FA) added/removed This email is rather simple and only invites the end-user to take actions if that change was not done by him (reset password, contact administrator, ...). Task-2639168 closes odoo/odoo#94922 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo.addons.mail.tests.common import MailCommon
|
|
from odoo.tests import users
|
|
|
|
|
|
class TestNotifySecurityUpdate(MailCommon):
|
|
|
|
@users('employee')
|
|
def test_security_update_email(self):
|
|
""" User should be notified on old email address when the email changes """
|
|
with self.mock_mail_gateway():
|
|
self.env.user.write({'email': 'new@example.com'})
|
|
|
|
self.assertMailMailWEmails(['e.e@example.com'], 'outgoing', fields_values={
|
|
'subject': 'Security Update: Email Changed',
|
|
})
|
|
|
|
@users('employee')
|
|
def test_security_update_login(self):
|
|
with self.mock_mail_gateway():
|
|
self.env.user.write({'login': 'newlogin'})
|
|
|
|
self.assertMailMailWEmails([self.env.user.email_formatted], 'outgoing', fields_values={
|
|
'subject': 'Security Update: Login Changed',
|
|
})
|
|
|
|
@users('employee')
|
|
def test_security_update_password(self):
|
|
with self.mock_mail_gateway():
|
|
self.env.user.write({'password': 'newpassword'})
|
|
|
|
self.assertMailMailWEmails([self.env.user.email_formatted], 'outgoing', fields_values={
|
|
'subject': 'Security Update: Password Changed',
|
|
})
|