Also show demo mode errors in the demo user profile page

This commit is contained in:
Johannes Zellner
2022-04-27 14:30:54 +02:00
parent db185c9146
commit 840e8153ff
2 changed files with 24 additions and 16 deletions
+21 -14
View File
@@ -320,13 +320,15 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
$scope.emailchange.busy = false;
if (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);
}
if (error.statusCode === 409) $scope.emailchange.error.email = 'Email already taken';
else if (error.statusCode === 400) $scope.emailchange.error.email = error.message;
else console.error('Unable to change email.', error);
$('#inputEmailChangeEmail').focus();
$scope.emailChangeForm.$setUntouched();
$scope.emailChangeForm.$setPristine();
return;
}
@@ -366,6 +368,7 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
submit: function () {
$scope.fallbackEmailChange.error.email = null;
$scope.fallbackEmailChange.error.password = null;
$scope.fallbackEmailChange.error.generic = null;
$scope.fallbackEmailChange.busy = true;
var data = {
@@ -382,9 +385,12 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
$scope.fallbackEmailChange.password = '';
$scope.fallbackEmailChangeForm.password.$setPristine();
$('#inputFallbackEmailChangePassword').focus();
} else if (error.statusCode === 400) {
$scope.fallbackEmailChange.error.generic = error.message;
} else {
console.error('Unable to change fallback email.', error);
}
return;
}
@@ -529,13 +535,14 @@ angular.module('Application').controller('ProfileController', ['$scope', '$trans
$scope.displayNameChange.busy = false;
if (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);
}
if (error.statusCode === 400) $scope.displayNameChange.error.displayName = error.message;
else console.error('Unable to change email.', error);
$('#inputDisplayNameChangeDisplayName').focus();
$scope.displayNameChangeForm.$setUntouched();
$scope.displayNameChangeForm.$setPristine();
return;
}