mirror of
https://github.com/zulip/zulip.git
synced 2025-11-08 07:52:19 +00:00
demo-orgs: Disable admin of authentication methods until email set.
Because demo organization owners do not initially have an email set, some of the personal and organization settings in the web-app UI should be disabled/hidden until the owner configures an email address for their account. Disables configuring organization authentication methods in the organization settings overlay until the user has configured an email address. Adds a tip at the top of the authentication methods tab to indicate why the authentication method checkboxes are disabled.
This commit is contained in:
committed by
Tim Abbott
parent
665deac7c0
commit
b0bc66a8ba
@@ -203,6 +203,7 @@ export function build_page() {
|
|||||||
allow_sorting_deactivated_users_list_by_email:
|
allow_sorting_deactivated_users_list_by_email:
|
||||||
settings_users.allow_sorting_deactivated_users_list_by_email(),
|
settings_users.allow_sorting_deactivated_users_list_by_email(),
|
||||||
has_bots: bot_data.get_all_bots_for_current_user().length > 0,
|
has_bots: bot_data.get_all_bots_for_current_user().length > 0,
|
||||||
|
user_has_email_set: !settings_data.user_email_not_configured(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (options.realm_logo_source !== "D" && options.realm_night_logo_source === "D") {
|
if (options.realm_logo_source !== "D" && options.realm_night_logo_source === "D") {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import * as realm_icon from "./realm_icon";
|
|||||||
import * as realm_logo from "./realm_logo";
|
import * as realm_logo from "./realm_logo";
|
||||||
import {realm_user_settings_defaults} from "./realm_user_settings_defaults";
|
import {realm_user_settings_defaults} from "./realm_user_settings_defaults";
|
||||||
import * as settings_config from "./settings_config";
|
import * as settings_config from "./settings_config";
|
||||||
|
import * as settings_data from "./settings_data";
|
||||||
import * as settings_notifications from "./settings_notifications";
|
import * as settings_notifications from "./settings_notifications";
|
||||||
import * as settings_realm_domains from "./settings_realm_domains";
|
import * as settings_realm_domains from "./settings_realm_domains";
|
||||||
import * as settings_realm_user_settings_defaults from "./settings_realm_user_settings_defaults";
|
import * as settings_realm_user_settings_defaults from "./settings_realm_user_settings_defaults";
|
||||||
@@ -533,6 +534,16 @@ function sort_object_by_key(obj) {
|
|||||||
return new_obj;
|
return new_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function can_configure_auth_methods() {
|
||||||
|
if (settings_data.user_email_not_configured()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (page_params.is_owner) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
export function populate_auth_methods(auth_methods) {
|
export function populate_auth_methods(auth_methods) {
|
||||||
if (!meta.loaded) {
|
if (!meta.loaded) {
|
||||||
return;
|
return;
|
||||||
@@ -544,7 +555,7 @@ export function populate_auth_methods(auth_methods) {
|
|||||||
rendered_auth_method_rows += render_settings_admin_auth_methods_list({
|
rendered_auth_method_rows += render_settings_admin_auth_methods_list({
|
||||||
method: auth_method,
|
method: auth_method,
|
||||||
enabled: value,
|
enabled: value,
|
||||||
is_owner: page_params.is_owner,
|
disable_configure_auth_method: !can_configure_auth_methods(),
|
||||||
// The negated character class regexp serves as an allowlist - the replace() will
|
// The negated character class regexp serves as an allowlist - the replace() will
|
||||||
// remove *all* symbols *but* digits (\d) and lowecase letters (a-z),
|
// remove *all* symbols *but* digits (\d) and lowecase letters (a-z),
|
||||||
// so that we can make assumptions on this string elsewhere in the code.
|
// so that we can make assumptions on this string elsewhere in the code.
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
prefix=prefix
|
prefix=prefix
|
||||||
is_checked=enabled
|
is_checked=enabled
|
||||||
label=method
|
label=method
|
||||||
is_disabled=(not is_owner) }}
|
is_disabled=disable_configure_auth_method}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
{{#unless is_owner}}
|
{{#unless is_owner}}
|
||||||
<div class='tip'>{{t "Only organization owners can edit these settings."}}</div>
|
<div class='tip'>{{t "Only organization owners can edit these settings."}}</div>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
|
{{#unless user_has_email_set}}
|
||||||
|
<div class='tip'>{{t "You must configure your email to access this feature."}}</div>
|
||||||
|
{{/unless}}
|
||||||
<form class="admin-realm-form org-authentications-form">
|
<form class="admin-realm-form org-authentications-form">
|
||||||
<div id="org-auth_settings" class="admin-table-wrapper settings-subsection-parent">
|
<div id="org-auth_settings" class="admin-table-wrapper settings-subsection-parent">
|
||||||
<div class ="subsection-header">
|
<div class ="subsection-header">
|
||||||
|
|||||||
Reference in New Issue
Block a user