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

@@ -269,8 +269,7 @@
<i class="fa fa-briefcase arrow" ng-show="user.admin" uib-tooltip="This user can manage apps, groups and other users"></i>
</td>
<td class="hand elide-table-cell" ng-click="showUserEdit(user)" ng-show="user.username">
{{ user.username }}
<span class="text-muted">{{ user.email }}</span>
{{ user.username }}<span class="text-muted" ng-show="user.alternateEmail">{{ '@' + config.fqdn }}</span><span class="text-muted" ng-hide="user.alternateEmail">{{ user.email }}</span>
</td>
<td class="hand elide-table-cell" ng-click="showUserEdit(user)" ng-hide="user.username">
<span class="text-muted" uib-tooltip="User is not activated yet">{{ user.alternateEmail || user.email }}</span>

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) {