From 6921da00b3a253ea5d0cdd135a8629ef9cb14ca7 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Wed, 15 Feb 2017 22:55:46 +0100 Subject: [PATCH] [FIX] auth_signup: properly log password reset requests --- addons/auth_signup/controllers/main.py | 3 +++ addons/auth_signup/models/res_users.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/addons/auth_signup/controllers/main.py b/addons/auth_signup/controllers/main.py index 2718e47dd2a..5b45e068289 100644 --- a/addons/auth_signup/controllers/main.py +++ b/addons/auth_signup/controllers/main.py @@ -57,6 +57,9 @@ class AuthSignupHome(Home): else: login = qcontext.get('login') assert login, "No login provided." + _logger.info( + "Password reset attempt for <%s> by user <%s> from %s", + login, request.env.user.login, request.httprequest.remote_addr) request.env['res.users'].sudo().reset_password(login) qcontext['message'] = _("An email has been sent with credentials to reset your password") except SignupError: diff --git a/addons/auth_signup/models/res_users.py b/addons/auth_signup/models/res_users.py index c82a35792a2..f348df3c49b 100644 --- a/addons/auth_signup/models/res_users.py +++ b/addons/auth_signup/models/res_users.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. +import logging from ast import literal_eval @@ -11,6 +12,7 @@ from odoo.tools.misc import ustr from odoo.addons.base.ir.ir_mail_server import MailDeliveryException from odoo.addons.auth_signup.models.res_partner import SignupError, now +_logger = logging.getLogger(__name__) class ResUsers(models.Model): _inherit = 'res.users' @@ -134,6 +136,7 @@ class ResUsers(models.Model): if not user.email: raise UserError(_("Cannot send email: user %s has no email address.") % user.name) template.with_context(lang=user.lang).send_mail(user.id, force_send=True, raise_exception=True) + _logger.info("Password reset email sent for user <%s> to <%s>", user.login, user.email) @api.model def create(self, values):