mirror of https://github.com/zulip/zulip.git
settings: Show error in change password modal if input is empty.
We show "Please enter your password" error inside the modal if the "Old password" input is empty and "Please choose a new password" error if the "New password" input is empty and do not send a request to server. Fixes #19901.
This commit is contained in:
parent
4e43239825
commit
aebbbcd03d
|
@ -459,12 +459,29 @@ export function set_up() {
|
|||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const change_password_error = $("#change_password_modal").find("#dialog_error");
|
||||
change_password_error.hide();
|
||||
|
||||
const data = {
|
||||
old_password: $("#old_password").val(),
|
||||
new_password: $("#new_password").val(),
|
||||
};
|
||||
|
||||
function show_error_message(rendered_error_msg) {
|
||||
change_password_error.html(rendered_error_msg);
|
||||
change_password_error.addClass("alert-error").show();
|
||||
dialog_widget.hide_dialog_spinner();
|
||||
}
|
||||
|
||||
if (data.old_password === "") {
|
||||
show_error_message($t_html({defaultMessage: "Please enter your password"}));
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.new_password === "") {
|
||||
show_error_message($t_html({defaultMessage: "Please choose a new password"}));
|
||||
return;
|
||||
}
|
||||
|
||||
const new_pw_field = $("#new_password");
|
||||
const new_pw = data.new_password;
|
||||
if (new_pw !== "") {
|
||||
|
|
Loading…
Reference in New Issue