Show error if email already taken on user edit form

This commit is contained in:
Johannes Zellner
2016-09-28 12:29:18 +02:00
parent b0c470da5a
commit b28c239dbf
2 changed files with 11 additions and 3 deletions

View File

@@ -276,7 +276,16 @@ angular.module('Application').controller('UsersController', ['$scope', '$locatio
Client.updateUser(data, function (error) {
if (error) {
$scope.useredit.busy = false;
return console.error('Unable to update user:', error);
if (error.statusCode === 409) {
$scope.useredit.error.email = 'Email already taken';
$scope.useredit_form.email.$setPristine();
$('#inputUserEditEmail').focus();
} else {
console.error('Unable to update user:', error);
}
return;
}
if ($scope.useredit.superuser) {