From 9aa4f288e7ebb73bdac585e02b826898fd80427c Mon Sep 17 00:00:00 2001 From: Ronald Portier Date: Thu, 28 Nov 2024 13:53:34 +0100 Subject: [PATCH] [FIX] auth_sms: always get config parm with sudo() --- auth_sms/models/res_users.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/auth_sms/models/res_users.py b/auth_sms/models/res_users.py index fce1c24c8..a3f6525e3 100644 --- a/auth_sms/models/res_users.py +++ b/auth_sms/models/res_users.py @@ -79,7 +79,9 @@ def _auth_sms_generate_code(self): random.choice(choices) for dummy in range( int( - self.env["ir.config_parameter"].get_param( + self.env["ir.config_parameter"] + .sudo() + .get_param( "auth_sms.code_length", 8, ), @@ -114,13 +116,17 @@ def _auth_sms_check_rate_limit(self): """return false if the user has requested an SMS code too often""" self.ensure_one() rate_limit_hours = float( - self.env["ir.config_parameter"].get_param( + self.env["ir.config_parameter"] + .sudo() + .get_param( "auth_sms.rate_limit_hours", 24, ) ) rate_limit_limit = float( - self.env["ir.config_parameter"].get_param( + self.env["ir.config_parameter"] + .sudo() + .get_param( "auth_sms.rate_limit_limit", 10, )