Add customizations for CUSTOMER16 employees' realm

CUSTOMER16 wants their employee realm to:
* only use JWT logins
* have name changes be disabled (they want users' full names to be the
  their CUSTOMER16 user name).
* not show the suggestion that users download the desktop app

(imported from commit cb5f72c993ddc26132ce50165bb68c3000276de0)
This commit is contained in:
Zev Benjamin
2014-03-27 19:53:29 -04:00
parent bd3f1c6a9e
commit 2f7af69091
5 changed files with 19 additions and 6 deletions

View File

@@ -40,6 +40,8 @@ exports.left_side_userlist = _.contains(['customer7.invalid'], page_params.domai
//the settings.html django template. See zerver/views/__init__.py:home(request).
exports.show_autoscroll_forever_option = page_params.show_autoscroll_forever_option;
exports.enable_new_user_app_alerts = ! _.contains(['employees.customer16.invalid'], page_params.domain);
// Still very beta:
exports.full_width = false; //page_params.staging;

View File

@@ -349,12 +349,14 @@ function finale() {
var alert_contents;
if (page_params.enable_new_user_app_alerts) {
if (page_params.prompt_for_invites) {
alert_contents = "<i class='icon-vector-heart alert-icon'></i>It's lonely in here! <a href='#invite-user' data-toggle='modal'>Invite some coworkers</a>.";
} else {
alert_contents = "<i class='icon-vector-desktop alert-icon'></i>What's better than Zulip in your browser? The <a href='/apps' target='_blank'>Zulip desktop app</a>!";
}
show_app_alert(alert_contents);
}
// We start you in a narrow so it's not overwhelming.
if (stream_data.in_home_view(page_params.notifications_stream)) {

View File

@@ -205,7 +205,7 @@ def principal_to_user_profile(agent, principal):
def name_changes_disabled(realm):
return (settings.NAME_CHANGES_DISABLED
or realm.domain in ('users.customer4.invalid'))
or realm.domain in ('users.customer4.invalid', 'employees.customer16.invalid'))
@require_post
@has_request_variables
@@ -302,6 +302,12 @@ def accounts_register(request):
form = RegistrationForm(
initial={'full_name': hesiod_name if "@" not in hesiod_name else ""})
name_validated = True
elif domain == 'employees.customer16.invalid':
full_name = email.rpartition('@')[0]
form = RegistrationForm(
initial={'full_name': full_name})
name_validated = True
request.session['authenticated_full_name'] = full_name
elif settings.POPULATE_PROFILE_VIA_LDAP:
for backend in get_backends():
if isinstance(backend, LDAPBackend):

View File

@@ -14,6 +14,8 @@ from apiclient.sample_tools import client as googleapiclient
from oauth2client.crypt import AppIdentityError
def password_auth_enabled(realm):
if realm.domain == 'employees.customer16.invalid':
return False
for backend in django.contrib.auth.get_backends():
if isinstance(backend, EmailAuthBackend):
return True

View File

@@ -1,6 +1,7 @@
# Secret Django settings for the Zulip project
import platform
import ConfigParser
from base64 import b64decode
config_file = ConfigParser.RawConfigParser()
config_file.read("/etc/zulip/zulip.conf")