Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Fix adding emails on registration #968

Merged
merged 2 commits into from
Aug 2, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions synapse/rest/client/v2_alpha/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,12 @@ def on_POST(self, request):
[LoginType.EMAIL_IDENTITY]
]

authed, result, params, session_id = yield self.auth_handler.check_auth(
authed, auth_result, params, session_id = yield self.auth_handler.check_auth(
flows, body, self.hs.get_ip_from_request(request)
)

if not authed:
defer.returnValue((401, result))
defer.returnValue((401, auth_result))
return

if registered_user_id is not None:
Expand Down Expand Up @@ -236,18 +236,18 @@ def on_POST(self, request):

add_email = True

result = yield self._create_registration_details(
return_dict = yield self._create_registration_details(
registered_user_id, params
)

if add_email and result and LoginType.EMAIL_IDENTITY in result:
threepid = result[LoginType.EMAIL_IDENTITY]
if add_email and auth_result and LoginType.EMAIL_IDENTITY in auth_result:
threepid = auth_result[LoginType.EMAIL_IDENTITY]
yield self._register_email_threepid(
registered_user_id, threepid, result["access_token"],
registered_user_id, threepid, return_dict["access_token"],
params.get("bind_email")
)

defer.returnValue((200, result))
defer.returnValue((200, return_dict))

def on_OPTIONS(self, _):
return 200, {}
Expand Down Expand Up @@ -356,8 +356,6 @@ def _register_email_threepid(self, user_id, threepid, token, bind_email):
else:
logger.info("bind_email not specified: not binding email")

defer.returnValue()

@defer.inlineCallbacks
def _create_registration_details(self, user_id, params):
"""Complete registration of newly-registered user
Expand Down