Display error in accounts UI

This commit is contained in:
Girish Ramakrishnan
2016-09-28 16:05:39 -07:00
parent 90aeeb3896
commit cdf0b8c1b0
2 changed files with 19 additions and 5 deletions

View File

@@ -97,7 +97,13 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client
$scope.emailchange.busy = false;
if (error) {
console.error('Unable to change email.', error);
if (error.statusCode === 409) {
$scope.emailchange.error.email = 'Email already taken';
$scope.emailChangeForm.email.$setPristine();
$('#inputEmailChangeEmail').focus();
} else {
console.error('Unable to change email.', error);
}
return;
}
@@ -142,7 +148,13 @@ angular.module('Application').controller('AccountController', ['$scope', 'Client
$scope.displayNameChange.busy = false;
if (error) {
console.error('Unable to change displayName.', error);
if (error.statusCode === 400) {
$scope.displayNameChange.error.displayName = 'Invalid display name';
$scope.displayNameChangeForm.email.$setPristine();
$('#inputDisplayNameChangeDisplayName').focus();
} else {
console.error('Unable to change email.', error);
}
return;
}