Skip to content
Snippets Groups Projects
Commit d019fcc9 authored by Shamil K's avatar Shamil K
Browse files

Fix M_USER_IN_USE race condition

parent 40e11225
No related merge requests found
...@@ -26,7 +26,7 @@ import logging ...@@ -26,7 +26,7 @@ import logging
from pkg_resources import parse_version from pkg_resources import parse_version
__VERSION__ = "0.2.1" __VERSION__ = "0.2.2"
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -98,7 +98,7 @@ class DiasporaAuthProvider: ...@@ -98,7 +98,7 @@ class DiasporaAuthProvider:
== encrypted_password.encode('utf8')): == encrypted_password.encode('utf8')):
logger.info("Password given for {} is wrong. Rejecting auth request.".format(local_part)) logger.info("Password given for {} is wrong. Rejecting auth request.".format(local_part))
defer.returnValue(False) defer.returnValue(False)
yield self.register_user(local_part, email) self.register_user(local_part, email)
logger.info("Confirming authentication request.") logger.info("Confirming authentication request.")
defer.returnValue(True) defer.returnValue(True)
...@@ -123,10 +123,11 @@ class DiasporaAuthProvider: ...@@ -123,10 +123,11 @@ class DiasporaAuthProvider:
if (yield self.account_handler.check_user_exists(local_part)): if (yield self.account_handler.check_user_exists(local_part)):
yield self.sync_email(local_part, email) yield self.sync_email(local_part, email)
defer.returnValue(local_part) defer.returnValue(local_part)
user_id = ( else:
user_id = (
yield self.account_handler.register_user(localpart=local_part, emails=[email]) yield self.account_handler.register_user(localpart=local_part, emails=[email])
) )
defer.returnValue(user_id) defer.returnValue(user_id)
@defer.inlineCallbacks @defer.inlineCallbacks
def sync_email(self, user_id, email): def sync_email(self, user_id, email):
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment