Add custom domain setup step
This commit is contained in:
@@ -28,8 +28,11 @@ app.config(['$routeProvider', function ($routeProvider) {
|
||||
controller: 'StepController',
|
||||
templateUrl: 'views/setup/step2.html'
|
||||
}).when('/step3', {
|
||||
controller: 'FinishController',
|
||||
controller: 'CustomDomainController',
|
||||
templateUrl: 'views/setup/step3.html'
|
||||
}).when('/step4', {
|
||||
controller: 'FinishController',
|
||||
templateUrl: 'views/setup/step4.html'
|
||||
}).otherwise({ redirectTo: '/'});
|
||||
}]);
|
||||
|
||||
@@ -95,6 +98,7 @@ app.service('Wizard', [ function () {
|
||||
}];
|
||||
this.avatar = {};
|
||||
this.avatarBlob = null;
|
||||
this.dnsConfig = null;
|
||||
}
|
||||
|
||||
Wizard.prototype.setPreviewAvatar = function (avatar) {
|
||||
@@ -194,6 +198,13 @@ app.controller('StepController', ['$scope', '$route', '$location', 'Wizard', fun
|
||||
|
||||
}]);
|
||||
|
||||
app.controller('CustomDomainController', [ '$scope', 'Wizard', function ($scope, Wizard) {
|
||||
$scope.wizard = Wizard;
|
||||
|
||||
|
||||
if (Wizard.dnsConfig === null) $location.path('/step4'); // not using custom domain
|
||||
}]);
|
||||
|
||||
app.controller('FinishController', ['$scope', '$location', '$timeout', 'Wizard', 'Client', function ($scope, $location, $timeout, Wizard, Client) {
|
||||
$scope.wizard = Wizard;
|
||||
|
||||
@@ -207,7 +218,11 @@ app.controller('FinishController', ['$scope', '$location', '$timeout', 'Wizard',
|
||||
Client.changeCloudronAvatar($scope.wizard.avatarBlob, function (error) {
|
||||
if (error) return console.error('Unable to set avatar.', error);
|
||||
|
||||
window.location.href = '/';
|
||||
Client.setDnsConfig($scope.wizard.dnsConfig, function (error) {
|
||||
if (error) return console.error('Unable to set dns config.', error);
|
||||
|
||||
window.location.href = '/';
|
||||
});
|
||||
});
|
||||
});
|
||||
}]);
|
||||
@@ -224,6 +239,14 @@ app.controller('SetupController', ['$scope', '$location', 'Client', 'Wizard', fu
|
||||
if (!search.email) return window.location.href = '/error.html?errorCode=3';
|
||||
Wizard.email = search.email;
|
||||
|
||||
if (search.customDomain === 'true') {
|
||||
Wizard.dnsConfig = {
|
||||
provider: 'route53',
|
||||
accessKeyId: null,
|
||||
secretAccessKey: null
|
||||
};
|
||||
}
|
||||
|
||||
Wizard.hostname = window.location.host.indexOf('my-') === 0 ? window.location.host.slice(3) : window.location.host;
|
||||
|
||||
Client.isServerFirstTime(function (error, isFirstTime) {
|
||||
|
||||
@@ -1,8 +1,27 @@
|
||||
<center>
|
||||
<h1>All done!</h1>
|
||||
<br/>
|
||||
<br/>
|
||||
<i class="fa fa-spinner fa-pulse fa-5x"></i>
|
||||
<br/>
|
||||
<br/>
|
||||
</center>
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center">
|
||||
<h1>Custom domain configuration</h1>
|
||||
<h4 class="">
|
||||
Provide <a href="https://aws.amazon.com/route53/">Route53</a> access keys here.
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-md-offset-4 text-center">
|
||||
<div class="form-group" ng-class="{ 'has-error': setup_form.accessKeyId.$dirty && setup_form.accessKeyId.$invalid }">
|
||||
<!-- <label class="control-label" for="inputUsername">Username</label> -->
|
||||
<input type="text" class="form-control" ng-model="wizard.dnsConfig.accessKeyId" id="inputAccessKeyId" name="accessKeyId" placeholder="Access Key Id" ng-enter="focusNext('inputSecretAccessKey', setup_form.secretAccessKey.$invalid)" ng-maxlength="512" ng-minlength="3" autofocus required autocomplete="off">
|
||||
</div>
|
||||
<div class="form-group" ng-class="{ 'has-error': setup_form.secretAccessKey.$dirty && setup_form.secretAccessKey.$invalid }">
|
||||
<!-- <label class="control-label" for="inputPassword">Password</label> -->
|
||||
<input type="text" class="form-control" ng-model="wizard.dnsConfig.secretAccessKey" id="inputSecretAccessKey" name="secretAccessKey" placeholder="Secret Access Key" ng-enter="next('/step4', setup_form.secretAccessKey.$invalid)" ng-maxlength="512" ng-minlength="3" required autocomplete="off">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center">
|
||||
<a class="btn btn-primary" href="#/step4" ng-disabled="setup_form.secretAccessKey.$invalid">Done</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
8
webadmin/src/views/setup/step4.html
Normal file
8
webadmin/src/views/setup/step4.html
Normal file
@@ -0,0 +1,8 @@
|
||||
<center>
|
||||
<h1>All done!</h1>
|
||||
<br/>
|
||||
<br/>
|
||||
<i class="fa fa-spinner fa-pulse fa-5x"></i>
|
||||
<br/>
|
||||
<br/>
|
||||
</center>
|
||||
Reference in New Issue
Block a user