Show error if email already taken on user edit form
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user