Merge pull request #22146 from owncloud/delete-email-address

Allow to delete the email address in user management
This commit is contained in:
Thomas Müller 2016-02-05 11:54:12 +01:00
commit 7dde2c773f
1 changed files with 14 additions and 18 deletions

View File

@ -732,24 +732,20 @@ $(document).ready(function () {
.focus() .focus()
.keypress(function (event) { .keypress(function (event) {
if (event.keyCode === 13) { if (event.keyCode === 13) {
if ($(this).val().length > 0) { $tr.data('mailAddress', $input.val());
$tr.data('mailAddress', $input.val()); $input.blur();
$input.blur(); $.ajax({
$.ajax({ type: 'PUT',
type: 'PUT', url: OC.generateUrl('/settings/users/{id}/mailAddress', {id: uid}),
url: OC.generateUrl('/settings/users/{id}/mailAddress', {id: uid}), data: {
data: { mailAddress: $(this).val()
mailAddress: $(this).val() }
} }).fail(function (result) {
}).fail(function (result) { OC.Notification.show(result.responseJSON.data.message);
OC.Notification.show(result.responseJSON.data.message); // reset the values
// reset the values $tr.data('mailAddress', mailAddress);
$tr.data('mailAddress', mailAddress); $tr.children('.mailAddress').children('span').text(mailAddress);
$tr.children('.mailAddress').children('span').text(mailAddress); });
});
} else {
$input.blur();
}
} }
}) })
.blur(function () { .blur(function () {