diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index fde530ace2..7864774e22 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -753,11 +753,11 @@ test("misc", ({override_rewire}) => { page_params.realm_email_changes_disabled = false; settings_account.update_email_change_display(); - assert.ok(!$("#change_email").prop("disabled")); + assert.ok(!$("#change_email_button").prop("disabled")); page_params.realm_email_changes_disabled = true; settings_account.update_email_change_display(); - assert.ok($("#change_email").prop("disabled")); + assert.ok($("#change_email_button").prop("disabled")); page_params.realm_avatar_changes_disabled = false; page_params.server_avatar_changes_disabled = false; @@ -783,7 +783,7 @@ test("misc", ({override_rewire}) => { assert.equal($(".change_name_tooltip").is(":visible"), false); settings_account.update_email_change_display(); - assert.ok(!$("#change_email").prop("disabled")); + assert.ok(!$("#change_email_button").prop("disabled")); override_rewire(stream_settings_data, "get_streams_for_settings_page", () => [ {name: "some_stream", stream_id: 75}, diff --git a/static/js/settings_account.js b/static/js/settings_account.js index aa2f4c80e5..b3d1133dac 100644 --- a/static/js/settings_account.js +++ b/static/js/settings_account.js @@ -32,7 +32,7 @@ import {user_settings} from "./user_settings"; let password_quality; // Loaded asynchronously export function update_email(new_email) { - const $email_input = $("#change_email"); + const $email_input = $("#change_email_button"); if ($email_input) { $email_input.text(new_email); @@ -61,10 +61,10 @@ export function update_name_change_display() { export function update_email_change_display() { if (page_params.realm_email_changes_disabled && !page_params.is_admin) { - $("#change_email").prop("disabled", true); + $("#change_email_button").prop("disabled", true); $(".change_email_tooltip").show(); } else { - $("#change_email").prop("disabled", false); + $("#change_email_button").prop("disabled", false); $(".change_email_tooltip").hide(); } } @@ -606,7 +606,7 @@ export function set_up() { e.stopPropagation(); const $change_email_error = $("#change_email_modal").find("#dialog_error"); const data = {}; - data.email = $("#change_email_container").find("input[name='email']").val(); + data.email = $("#change_email_form").find("input[name='email']").val(); const opts = { success_continuation() { @@ -640,12 +640,12 @@ export function set_up() { } function change_email_post_render() { - const $input_elem = $("#change_email_container").find("input[name='email']"); - const email = $("#change_email").text().trim(); + const $input_elem = $("#change_email_form").find("input[name='email']"); + const email = $("#change_email_button").text().trim(); $input_elem.val(email); } - $("#change_email").on("click", (e) => { + $("#change_email_button").on("click", (e) => { e.preventDefault(); e.stopPropagation(); if (!page_params.realm_email_changes_disabled || page_params.is_admin) { @@ -655,11 +655,11 @@ export function set_up() { html_submit_button: $t_html({defaultMessage: "Change"}), loading_spinner: true, id: "change_email_modal", - form_id: "change_email_container", + form_id: "change_email_form", on_click: do_change_email, post_render: change_email_post_render, on_shown() { - $("#change_email_container input").trigger("focus"); + $("#change_email_form input").trigger("focus"); }, }); } diff --git a/static/styles/settings.css b/static/styles/settings.css index 9ce54c6c38..d605e65ef4 100644 --- a/static/styles/settings.css +++ b/static/styles/settings.css @@ -167,7 +167,7 @@ h3, } #change_email_modal { - #change_email_container { + #change_email_form { margin: 0; } } diff --git a/static/templates/change_email_modal.hbs b/static/templates/change_email_modal.hbs index ee0cb0b123..2bd961d135 100644 --- a/static/templates/change_email_modal.hbs +++ b/static/templates/change_email_modal.hbs @@ -1,4 +1,4 @@ -
+
diff --git a/static/templates/settings/account_settings.hbs b/static/templates/settings/account_settings.hbs index 0f44e29233..a19d515302 100644 --- a/static/templates/settings/account_settings.hbs +++ b/static/templates/settings/account_settings.hbs @@ -8,7 +8,7 @@
-