From d019fcc94ebc2570793fa3aa4070ee84673ca38b Mon Sep 17 00:00:00 2001 From: Shamil K <nessessery129@gmail.com> Date: Wed, 24 Jun 2020 22:30:32 +0530 Subject: [PATCH] Fix M_USER_IN_USE race condition --- diaspora_auth_provider.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/diaspora_auth_provider.py b/diaspora_auth_provider.py index 4f17281..067ae1a 100644 --- a/diaspora_auth_provider.py +++ b/diaspora_auth_provider.py @@ -26,7 +26,7 @@ import logging from pkg_resources import parse_version -__VERSION__ = "0.2.1" +__VERSION__ = "0.2.2" logger = logging.getLogger(__name__) @@ -98,7 +98,7 @@ class DiasporaAuthProvider: == encrypted_password.encode('utf8')): logger.info("Password given for {} is wrong. Rejecting auth request.".format(local_part)) defer.returnValue(False) - yield self.register_user(local_part, email) + self.register_user(local_part, email) logger.info("Confirming authentication request.") defer.returnValue(True) @@ -123,10 +123,11 @@ class DiasporaAuthProvider: if (yield self.account_handler.check_user_exists(local_part)): yield self.sync_email(local_part, email) defer.returnValue(local_part) - user_id = ( + else: + user_id = ( yield self.account_handler.register_user(localpart=local_part, emails=[email]) - ) - defer.returnValue(user_id) + ) + defer.returnValue(user_id) @defer.inlineCallbacks def sync_email(self, user_id, email): -- GitLab