Make password_auth_enabled() take a realm object

This will actually be used in an upcoming commit.

(imported from commit 5d3db685a245899b2523440398f2ed2f0cfec4f4)
This commit is contained in:
Zev Benjamin
2014-03-27 19:45:03 -04:00
parent 2cfeef606c
commit 2e1d5ffd1c
4 changed files with 21 additions and 8 deletions

View File

@@ -5,6 +5,10 @@ import ujson
from zproject.backends import password_auth_enabled
def add_settings(request):
if hasattr(request.user, "realm"):
is_pw_auth_enabled = password_auth_enabled(request.user.realm)
else:
is_pw_auth_enabled = True
return {
'full_navbar': settings.FULL_NAVBAR,
# We use the not_enterprise variable name so that templates
@@ -12,7 +16,7 @@ def add_settings(request):
# to the template
'not_enterprise': not settings.ENTERPRISE,
'zulip_admin': settings.ZULIP_ADMINISTRATOR,
'password_auth_enabled': password_auth_enabled(),
'password_auth_enabled': is_pw_auth_enabled,
'login_url': settings.HOME_NOT_LOGGED_IN,
'only_sso': settings.ONLY_SSO,
'external_api_path': settings.EXTERNAL_API_PATH,