[FIX] auth_totp: Ignore email alert for API connections
Description of the issue/behavior this commit addresses: When 2FA is on on a user and he tries to use an API key to do a xmlrpc request, the request fails. This is due to the system which choses whether or not to send an alert via mail to look in the request's values while there is actually no url request in that case. Desired behavior after this commit is merged: This commit adds a check to make sure a request is available before checking its values. opw-3645609 closes odoo/odoo#147475 Signed-off-by: Thomas Becquevort (thbe) <thbe@odoo.com>
This commit is contained in:
@@ -48,7 +48,7 @@ class Users(models.Model):
|
||||
|
||||
To be overriden if needs to be disabled for other 2FA providers
|
||||
"""
|
||||
if self._mfa_type():
|
||||
if request and self._mfa_type():
|
||||
key = request.httprequest.cookies.get('td_id')
|
||||
if key:
|
||||
if request.env['auth_totp.device']._check_credentials_for_uid(
|
||||
|
||||
Reference in New Issue
Block a user