mirror of
https://github.com/zulip/zulip.git
synced 2025-11-14 02:48:00 +00:00
auth: Simplify REALMS_HAVE_SUBDOMAINS redirect code.
This logic was just a duplicate on realm.uri, except that in the case that subdomains are disabled, it preserves the host in the request.
This commit is contained in:
@@ -85,10 +85,7 @@ def login_or_register_remote_user(request, remote_username, user_profile, full_n
|
|||||||
else:
|
else:
|
||||||
login(request, user_profile)
|
login(request, user_profile)
|
||||||
if settings.REALMS_HAVE_SUBDOMAINS and user_profile.realm.subdomain is not None:
|
if settings.REALMS_HAVE_SUBDOMAINS and user_profile.realm.subdomain is not None:
|
||||||
return HttpResponseRedirect("%s%s.%s" % (settings.EXTERNAL_URI_SCHEME,
|
return HttpResponseRedirect(user_profile.realm.uri)
|
||||||
user_profile.realm.subdomain,
|
|
||||||
settings.EXTERNAL_HOST))
|
|
||||||
|
|
||||||
return HttpResponseRedirect("%s%s" % (settings.EXTERNAL_URI_SCHEME,
|
return HttpResponseRedirect("%s%s" % (settings.EXTERNAL_URI_SCHEME,
|
||||||
request.get_host()))
|
request.get_host()))
|
||||||
|
|
||||||
@@ -287,12 +284,8 @@ def dev_direct_login(request, **kwargs):
|
|||||||
if user_profile is None:
|
if user_profile is None:
|
||||||
raise Exception("User cannot login")
|
raise Exception("User cannot login")
|
||||||
login(request, user_profile)
|
login(request, user_profile)
|
||||||
if settings.REALMS_HAVE_SUBDOMAINS and settings.DEVELOPMENT:
|
if settings.REALMS_HAVE_SUBDOMAINS and user_profile.realm.subdomain is not None:
|
||||||
if user_profile.realm.subdomain is not None:
|
return HttpResponseRedirect(user_profile.realm.uri)
|
||||||
return HttpResponseRedirect("%s%s.%s" % (settings.EXTERNAL_URI_SCHEME,
|
|
||||||
user_profile.realm.subdomain,
|
|
||||||
settings.EXTERNAL_HOST))
|
|
||||||
|
|
||||||
return HttpResponseRedirect("%s%s" % (settings.EXTERNAL_URI_SCHEME,
|
return HttpResponseRedirect("%s%s" % (settings.EXTERNAL_URI_SCHEME,
|
||||||
request.get_host()))
|
request.get_host()))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user