diff --git a/dashboard/src/views/appstore.html b/dashboard/src/views/appstore.html index 0253d1211..e142d52a4 100644 --- a/dashboard/src/views/appstore.html +++ b/dashboard/src/views/appstore.html @@ -380,7 +380,7 @@
- +
{{ appstoreLogin.error.setupToken }}
diff --git a/dashboard/src/views/appstore.js b/dashboard/src/views/appstore.js index c50d6dbd1..a2a2ef57d 100644 --- a/dashboard/src/views/appstore.js +++ b/dashboard/src/views/appstore.js @@ -432,8 +432,8 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$tran if (error.statusCode === 409) { $scope.appstoreLogin.error.email = 'An account with this email already exists'; $scope.appstoreLogin.password = ''; - $scope.appstoreLoginForm.email.$setPristine(); - $scope.appstoreLoginForm.password.$setPristine(); + $scope.appstoreSignupForm.email.$setPristine(); + $scope.appstoreSignupForm.password.$setPristine(); $('#inputAppstoreLoginEmail').focus(); } else if (error.statusCode === 412) { if (error.message.indexOf('TOTP token missing') !== -1) { @@ -456,11 +456,18 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$tran $scope.appstoreLogin.password = ''; $scope.appstoreLoginForm.email.$setPristine(); $scope.appstoreLoginForm.password.$setPristine(); + $scope.appstoreSignupForm.email.$setPristine(); + $scope.appstoreSignupForm.password.$setPristine(); $('#inputAppstoreLoginEmail').focus(); } else { console.error(error); $scope.appstoreLogin.error.generic = error.message; } + } else if (error.statusCode === 402) { + $scope.appstoreLogin.error.setupToken = 'Invalid or expired setup token'; + $scope.appstoreLogin.setupToken = ''; + $scope.appstoreSetupTokenForm.setupToken.$setPristine(); + $('#inputAppstoreSetupToken').focus(); } else { console.error(error); $scope.appstoreLogin.error.generic = error.message || 'Please retry later'; diff --git a/src/appstore.js b/src/appstore.js index 5295bb5bb..b911e45a2 100644 --- a/src/appstore.js +++ b/src/appstore.js @@ -294,6 +294,7 @@ async function registerCloudron(data) { .ok(() => true)); if (error) throw new BoxError(BoxError.NETWORK_ERROR, error.message); + if (response.status === 401) throw new BoxError(BoxError.LICENSE_ERROR, 'Setup token invalid'); if (response.status !== 201) throw new BoxError(BoxError.EXTERNAL_ERROR, `Unable to register cloudron: ${response.statusCode} ${error.message}`); // cloudronId, token