Show correct error when email is invalid in setup

This commit is contained in:
Johannes Zellner
2023-02-02 14:42:18 +01:00
parent 66e08efee7
commit 72113c718b
2 changed files with 13 additions and 5 deletions
+12 -4
View File
@@ -39,10 +39,18 @@ app.controller('SetupController', ['$scope', 'Client', function ($scope, Client)
Client.createAdmin(data, function (error) {
if (error && error.statusCode === 400) {
$scope.owner.busy = false;
$scope.owner.error = { username: error.message };
$scope.owner.username = '';
$scope.ownerForm.username.$setPristine();
setTimeout(function () { $('#inputUsername').focus(); }, 200);
if (error.message === 'Invalid email') {
$scope.owner.error = { email: error.message };
$scope.owner.email = '';
$scope.ownerForm.email.$setPristine();
setTimeout(function () { $('#inputEmail').focus(); }, 200);
} else {
$scope.owner.error = { username: error.message };
$scope.owner.username = '';
$scope.ownerForm.username.$setPristine();
setTimeout(function () { $('#inputUsername').focus(); }, 200);
}
return;
} else if (error) {
$scope.owner.busy = false;