From f1f444b94d5882efa1a807d4c4eba41215c2595f Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Wed, 16 Aug 2023 14:49:51 +0200 Subject: [PATCH] Add license validity check to login handler --- server/oauth/user_signup_login_handler.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/oauth/user_signup_login_handler.py b/server/oauth/user_signup_login_handler.py index fa3758c4..38f1fec1 100644 --- a/server/oauth/user_signup_login_handler.py +++ b/server/oauth/user_signup_login_handler.py @@ -21,6 +21,9 @@ def handle_user_and_verify_products(user_data, token): license = License.objects.get_active_license_for_user(user) + if license and not license.is_valid(): + license = None + if not license: license, error_msg = check_and_create_licenses(hep_client, user, token) @@ -29,7 +32,7 @@ def handle_user_and_verify_products(user_data, token): create_role_for_user(user, license.for_role.key) - if not license.is_valid(): + if license and not license.is_valid(): return user, NO_VALID_LICENSE return user, None