change-email: Implement confirmation flow.

This adds to Zulip support for a user changing their own email
address.

It's backed by a huge amount of work by Steve Howell on making email
changes actually work from a UI perspective.

Fixes #734.
This commit is contained in:
Umair Khan
2017-01-20 16:27:38 +05:00
committed by Tim Abbott
parent 1929cc5190
commit 5bf83f9e0a
19 changed files with 484 additions and 8 deletions

View File

@@ -517,12 +517,44 @@ function _setup_page() {
});
});
$('#change_email_button').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
$('#change_email_modal').modal('hide');
var data = {};
data.email = $('.email_change_container').find("input[name='email']").val();
channel.patch({
url: '/json/settings/change',
data: data,
success: function (data) {
if ('account_email' in data) {
settings_change_success(data.account_email);
} else {
settings_change_error(i18n.t("Error changing settings: No new data supplied."));
}
},
error: function (xhr) {
settings_change_error("Error changing settings", xhr);
},
});
});
$('#default_language').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
$('#default_language_modal').show().attr('aria-hidden', false);
});
$('#change_email').on('click', function (e) {
e.preventDefault();
e.stopPropagation();
$('#change_email_modal').modal('show');
var email = $('#email_value').text();
$('.email_change_container').find("input[name='email']").val(email);
});
$("#user_deactivate_account_button").on('click', function (e) {
e.preventDefault();
e.stopPropagation();