summaryrefslogtreecommitdiffstats
path: root/settings/js/personal.js
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-12-15 12:43:42 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-12-18 22:43:09 +0100
commit5913af8a72e384f8fee89501b3a297b70460c1e0 (patch)
tree7f329b47b84bc312952d66f8f86f3f7e66ae9476 /settings/js/personal.js
parent5327b8043019ec8f0cfe19d70794978570bba4bc (diff)
downloadnextcloud-server-5913af8a72e384f8fee89501b3a297b70460c1e0.tar.gz
nextcloud-server-5913af8a72e384f8fee89501b3a297b70460c1e0.zip
Mail address of users is now changable in the user management
* introduced new route settings/users/{id}/mailAddress * kept old responses * better error messages * dropped lostpassword.php from settings/ajax * cleaned up the UserList.add() and hand in user object instead of each attribute as another parameter * check for change permission of mail address * proper response messages
Diffstat (limited to 'settings/js/personal.js')
-rw-r--r--settings/js/personal.js17
1 files changed, 14 insertions, 3 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js
index b2efa7c37f9..1ce9da55d85 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -45,9 +45,20 @@ function changeEmailAddress () {
}
emailInfo.defaultValue = emailInfo.val();
OC.msg.startSaving('#lostpassword .msg');
- var post = $("#lostpassword").serialize();
- $.post('ajax/lostpassword.php', post, function (data) {
- OC.msg.finishedSaving('#lostpassword .msg', data);
+ var post = $("#lostpassword").serializeArray();
+ $.ajax({
+ type: 'PUT',
+ url: OC.generateUrl('/settings/users/{id}/mailAddress', {id: OC.currentUser}),
+ data: {
+ mailAddress: post[0].value
+ }
+ }).done(function(result){
+ // I know the following 4 lines look weird, but that is how it works
+ // in jQuery - for success the first parameter is the result
+ // for failure the first parameter is the result object
+ OC.msg.finishedSaving('#lostpassword .msg', result);
+ }).fail(function(result){
+ OC.msg.finishedSaving('#lostpassword .msg', result.responseJSON);
});
}