From b69724f60e08f7a94749be36ff0d5402754c1a3d Mon Sep 17 00:00:00 2001 From: Eduardo Robles Date: Sat, 4 Dec 2021 07:43:13 +0100 Subject: [PATCH] remove duplication of verify_num_successful_logins code (#159) --- authapi/authmethods/m_emailpwd.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/authapi/authmethods/m_emailpwd.py b/authapi/authmethods/m_emailpwd.py index 72e40a77..419dd436 100644 --- a/authapi/authmethods/m_emailpwd.py +++ b/authapi/authmethods/m_emailpwd.py @@ -188,15 +188,12 @@ def authenticate(self, auth_event, request, mode='authenticate'): return self.authenticate_error("invalid-pipeline", req, auth_event) if mode == "authenticate": - if not verify_num_successful_logins(auth_event, 'OpenIdConnect', user, req): + if not verify_num_successful_logins( + auth_event, 'EmailPWD', user, req + ): return self.authenticate_error( "invalid_num_successful_logins_allowed", req, auth_event ) - if (auth_event.num_successful_logins_allowed > 0 and - user.userdata.successful_logins.filter(is_active=True).count() >= auth_event.num_successful_logins_allowed): - return self.authenticate_error( - "invalid_num_successful_logins_allowed", req, auth_event) - return return_auth_data('PWD', req, request, user, auth_event) LOGGER.debug(\