From 2f7c77fd9f847664230a6da68c88729e106ee509 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sat, 18 Apr 2020 00:58:48 +0200 Subject: [PATCH] Fix #247 --- users/models.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/users/models.py b/users/models.py index 36558a74..621617c3 100755 --- a/users/models.py +++ b/users/models.py @@ -1394,14 +1394,15 @@ class Adherent(User): :return: a message and a boolean which is True if the user can create a user or if the `options.all_can_create` is set. """ - if not user_request.is_authenticated and not OptionalUser.get_cached_value( - "self_adhesion" - ): - return False, _("Self registration is disabled."), None + if not user_request.is_authenticated: + if not OptionalUser.get_cached_value( + "self_adhesion" + ): + return False, _("Self registration is disabled."), None + else: + return True, None, None else: - if OptionalUser.get_cached_value( - "all_can_create_adherent" - ) or OptionalUser.get_cached_value("self_adhesion"): + if OptionalUser.get_cached_value("all_can_create_adherent"): return True, None, None else: can = user_request.has_perm("users.add_user")