From 42902fbd7e92be606363bdd0b52f7e7638f59883 Mon Sep 17 00:00:00 2001 From: AaronKable Date: Wed, 7 Jul 2021 11:43:43 +0800 Subject: [PATCH] lower email --- wikijs/manager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wikijs/manager.py b/wikijs/manager.py index f2fc07f..137643f 100644 --- a/wikijs/manager.py +++ b/wikijs/manager.py @@ -95,7 +95,7 @@ def __generate_group_list(self, names): ### Users ***************************************************************************************************** def __find_user(self, email): logger.debug("Hitting API looking for: {}".format(email[:10])) - data = json.loads(self.client.execute(_find_user_query, variables={"char_email":email})) + data = json.loads(self.client.execute(_find_user_query, variables={"char_email":email.lower()})) logger.debug("API returned: {}".format(data)) users = data.get("data", {}).get("users", {}).get("search", []) if users is None: @@ -121,12 +121,12 @@ def __create_user(self, user, password=False): data = json.loads(self.client.execute(_create_user_mutation, variables={ "group_list":group_list, - "email":user.email, + "email":user.email.lower(), "name":name, "pass":password})) logger.debug("API returned: {}".format(data)) if data["data"]["users"]["create"]["responseResult"]["succeeded"]: - uid = self.__find_user(user.email) + uid = self.__find_user(user.lower()) if uid: WikiJs.objects.update_or_create(user=user, uid=uid) return uid @@ -225,7 +225,7 @@ def update_user(self, user): def activate_user(self, user): #search try: - uid = self.__find_user(user.email) + uid = self.__find_user(user.email.lower()) #create if not uid: logger.info("Creating new user for {}".format(user.username))