Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

change_password_modal: Hide the dialog spinner when action fails.

Maneesh Shukla205cfc0f8508
diff --git a/web/src/password_quality.ts b/web/src/password_quality.ts
index c8741e913f4..f56e4e6af3b 100644
--- a/web/src/password_quality.ts
+++ b/web/src/password_quality.ts
@@ -60,7 +60,7 @@ export function password_warning(password: string, $password_field: JQuery): str
if (password.length < min_length) {
return $t(
- {defaultMessage: "Password should be at least {length} characters long"},
+ {defaultMessage: "Password should be at least {length} characters long."},
{length: min_length},
);
} else if (password.length > max_length) {
@@ -71,5 +71,5 @@ export function password_warning(password: string, $password_field: JQuery): str
{max: max_length},
);
}
- return zxcvbn(password).feedback.warning ?? $t({defaultMessage: "Password is too weak"});
+ return zxcvbn(password).feedback.warning ?? $t({defaultMessage: "Password is too weak."});
}
diff --git a/web/src/settings_account.ts b/web/src/settings_account.ts
index 719b80c1aa5..f8099382764 100644
--- a/web/src/settings_account.ts
+++ b/web/src/settings_account.ts
@@ -199,7 +199,8 @@ export function update_send_read_receipts_tooltip(): void {
}
function settings_change_error(message_html: string, xhr?: JQuery.jqXHR): void {
- ui_report.error(message_html, xhr, $("#account-settings-status").expectOne());
+ ui_report.error(message_html, xhr, $("#dialog_error"));
+ dialog_widget.hide_dialog_spinner();
}
function update_custom_profile_field(
@@ -463,7 +464,7 @@ export function set_up(): void {
if (old_password === "") {
ui_report.error(
- $t_html({defaultMessage: "Please enter your password"}),
+ $t_html({defaultMessage: "Please enter your password."}),
undefined,
$("#dialog_error"),
);
@@ -472,7 +473,7 @@ export function set_up(): void {
if (new_password === "") {
ui_report.error(
- $t_html({defaultMessage: "Please choose a new password"}),
+ $t_html({defaultMessage: "Please choose a new password."}),
undefined,
$("#dialog_error"),
);
@@ -483,7 +484,7 @@ export function set_up(): void {
if (new_password && new_password.toString().length > max_length) {
ui_report.error(
$t_html(
- {defaultMessage: "Maximum password length: {max_length} characters"},
+ {defaultMessage: "Maximum password length: {max_length} characters."},
{max_length},
),
undefined,
@@ -549,7 +550,7 @@ export function set_up(): void {
);
return;
} else if (!password_quality(new_pw, undefined, $new_pw_field)) {
- settings_change_error($t_html({defaultMessage: "New password is too weak"}));
+ settings_change_error($t_html({defaultMessage: "New password is too weak!"}));
return;
}
}
diff --git a/web/tests/password.test.cjs b/web/tests/password.test.cjs
index 10a0cca3e4f..36786d0f242 100644
--- a/web/tests/password.test.cjs
+++ b/web/tests/password.test.cjs
@@ -59,7 +59,7 @@ run_test("basics w/progress bar", () => {
assert.equal($bar.w, "39.7%");
assert.equal($bar.added_class, "bar-danger");
warning = password_warning(password, password_field(10));
- assert.equal(warning, "translated: Password should be at least 10 characters long");
+ assert.equal(warning, "translated: Password should be at least 10 characters long.");
password = "foo";
accepted = password_quality(password, $bar, password_field(2, 200, 10));
@@ -67,7 +67,7 @@ run_test("basics w/progress bar", () => {
assert.equal($bar.w, "10.390277164940581%");
assert.equal($bar.added_class, "bar-success");
warning = password_warning(password, password_field(2));
- assert.equal(warning, "translated: Password is too weak");
+ assert.equal(warning, "translated: Password is too weak.");
password = "aaaaaaaa";
accepted = password_quality(password, $bar, password_field(6, 1e100));