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