demo-orgs: Hide change password field if email not configured.

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.

Updates showing the password change field in the account & privacy
tab of the personal settings overlay to check if the user's email
being configured (to cover the demo organization case) and if the
organization has enabled password authorization.
This commit is contained in:
Lauryn Menard 2023-01-20 17:27:48 +01:00 committed by Tim Abbott
parent fd45350532
commit 6a36340ac7
2 changed files with 9 additions and 1 deletions

View File

@ -73,6 +73,13 @@ function get_parsed_date_of_joining() {
);
}
function user_can_change_password() {
if (settings_data.user_email_not_configured()) {
return false;
}
return page_params.realm_email_auth_enabled;
}
export function build_page() {
setup_settings_label();
@ -119,6 +126,7 @@ export function build_page() {
user_is_only_organization_owner: people.is_current_user_only_owner(),
email_address_visibility_values: settings_config.email_address_visibility_values,
owner_is_only_user_in_organization: people.get_active_human_count() === 1,
user_can_change_password: user_can_change_password(),
});
settings_bots.update_bot_settings_tip($("#personal-bot-settings-tip"), false);

View File

@ -25,7 +25,7 @@
{{/if}}
<form class="password-change-form grid">
{{#if page_params.realm_email_auth_enabled}}
{{#if user_can_change_password}}
<div>
<label class="inline-block title">{{t "Password" }}</label>
<div class="input-group inline-block" id="pw_change_link">