demo-orgs: Enable admin of auth methods for owner without email.

There is no technical reason to block updating the authentication
methods for the demo organization when the owner has not yet set
an email.

If they get locked out of the demo organization when they set an
email address for their account, they can just create another demo
organization. These organizations are primarily intended to be
temporary sandboxes for trying out Zulip.

Co-authored-by: Maneesh Shukla <shuklamaneesh24@gmail.com>
This commit is contained in:
Lauryn Menard
2025-05-12 16:00:27 +02:00
committed by Tim Abbott
parent 36b63adc03
commit 3a87b467e9
2 changed files with 1 additions and 20 deletions

View File

@@ -33,7 +33,6 @@ import {
} from "./settings_components.ts"; } from "./settings_components.ts";
import * as settings_components from "./settings_components.ts"; import * as settings_components from "./settings_components.ts";
import * as settings_config from "./settings_config.ts"; import * as settings_config from "./settings_config.ts";
import * as settings_data from "./settings_data.ts";
import * as settings_notifications from "./settings_notifications.ts"; import * as settings_notifications from "./settings_notifications.ts";
import * as settings_realm_domains from "./settings_realm_domains.ts"; import * as settings_realm_domains from "./settings_realm_domains.ts";
import * as settings_ui from "./settings_ui.ts"; import * as settings_ui from "./settings_ui.ts";
@@ -402,16 +401,6 @@ export function populate_realm_domains_label(
$("#allowed_domains_label").text($t({defaultMessage: "Allowed domains: {domains}"}, {domains})); $("#allowed_domains_label").text($t({defaultMessage: "Allowed domains: {domains}"}, {domains}));
} }
function can_configure_auth_methods(): boolean {
if (settings_data.user_email_not_configured()) {
return false;
}
if (current_user.is_owner) {
return true;
}
return false;
}
export function populate_auth_methods(auth_method_to_bool_map: Record<string, boolean>): void { export function populate_auth_methods(auth_method_to_bool_map: Record<string, boolean>): void {
if (!meta.loaded) { if (!meta.loaded) {
return; return;
@@ -433,7 +422,7 @@ export function populate_auth_methods(auth_method_to_bool_map: Record<string, bo
const render_args = { const render_args = {
method: auth_method, method: auth_method,
enabled: value, enabled: value,
disable_configure_auth_method: !can_configure_auth_methods() || cant_be_enabled, disable_configure_auth_method: !current_user.is_owner || cant_be_enabled,
// 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 lowercase letters (a-z), // remove *all* symbols *but* digits (\d) and lowercase 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.

View File

@@ -2,14 +2,6 @@
{{#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">
{{#tr}}
You must <z-link>configure your email</z-link> to access this feature.
{{#*inline "z-link"}}<a href="/help/demo-organizations#configure-email-for-demo-organization-owner" target="_blank" rel="noopener noreferrer">{{> @partial-block }}</a>{{/inline}}
{{/tr}}
</div>
{{/unless}}
<form class="admin-realm-form org-authentications-form"> <form class="admin-realm-form org-authentications-form">
<div id="org-auth_settings" class="settings-subsection-parent"> <div id="org-auth_settings" class="settings-subsection-parent">
<div class ="subsection-header"> <div class ="subsection-header">