Show instance id input on cloudron setup for amis
This commit is contained in:
@@ -20,15 +20,20 @@ app.controller('SetupController', ['$scope', '$http', 'Client', function ($scope
|
||||
$scope.provider = '';
|
||||
$scope.apiServerOrigin = '';
|
||||
$scope.setupToken = '';
|
||||
$scope.instanceId = '';
|
||||
|
||||
$scope.activateCloudron = function () {
|
||||
$scope.busy = true;
|
||||
|
||||
Client.createAdmin($scope.account.username, $scope.account.password, $scope.account.email, $scope.account.displayName, $scope.setupToken, function (error) {
|
||||
if (error) {
|
||||
Client.createAdmin($scope.account.username, $scope.account.password, $scope.account.email, $scope.account.displayName, $scope.setupToken || $scope.instanceId, function (error) {
|
||||
$scope.busy = false;
|
||||
|
||||
if (error && error.statusCode === 403) {
|
||||
$scope.error = $scope.provider === 'ami' ? 'Wrong instance id' : 'Wrong setup token';
|
||||
return;
|
||||
} else if (error) {
|
||||
console.error('Internal error', error);
|
||||
$scope.error = error;
|
||||
$scope.busy = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -77,6 +82,7 @@ app.controller('SetupController', ['$scope', '$http', 'Client', function ($scope
|
||||
$scope.account.displayName = search.displayName || $scope.account.displayName;
|
||||
$scope.account.requireEmail = !search.email;
|
||||
$scope.provider = status.provider;
|
||||
$scope.instanceId = search.instanceId;
|
||||
$scope.apiServerOrigin = status.apiServerOrigin;
|
||||
|
||||
$scope.initialized = true;
|
||||
|
||||
@@ -77,6 +77,11 @@
|
||||
<small ng-show="setupForm.password.$dirty && setupForm.password.$invalid">Password must be 8-30 character with at least one uppercase, one numeric and one special character</small>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" ng-class="{ 'has-error': setupForm.instanceId.$dirty && (setupForm.instanceId.$invalid || error) }" ng-show="provider === 'ami'">
|
||||
<p>Provide the EC2 instance id to proof you are the owner</p>
|
||||
<input type="text" class="form-control" ng-model="instanceId" id="inputInstanceId" name="instanceId" placeholder="AWS EC2 instance id" ng-maxlength="20" ng-minlength="10" required autocomplete="off">
|
||||
<p ng-show="error" class="has-error">{{ error }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user