Fix Invitations on ONLY_SSO deploys (Zulip Enterprise)

(imported from commit 6807adbd39682ba91a5746e8a75d7ce53f632ab3)
This commit is contained in:
acrefoot 2013-11-14 00:05:55 -05:00 committed by Tim Abbott
parent b469066e66
commit 54d72d9a55

View File

@ -487,7 +487,15 @@ def maybe_send_to_registration(request, email, full_name=''):
if form.is_valid():
# Construct a PreregistrationUser object and send the user over to
# the confirmation view.
prereg_user = create_preregistration_user(email, request)
prereg_user = None
if settings.ONLY_SSO:
try:
prereg_user = PreregistrationUser.objects.filter(email__iexact=email).latest("invited_at")
except PreregistrationUser.DoesNotExist:
prereg_user = create_preregistration_user(email, request)
else:
prereg_user = create_preregistration_user(email, request)
return redirect("".join((
"/",
# Split this so we only get the part after the /