Fix setup wizard dependency on setupToken

This commit is contained in:
Johannes Zellner
2015-12-29 15:27:46 +01:00
parent 3a4ec5c86a
commit d83939b165
2 changed files with 9 additions and 5 deletions

View File

@@ -43,6 +43,8 @@ app.service('Wizard', [ function () {
this.username = '';
this.email = '';
this.password = '';
this.setupToken = null;
this.provider = null;
this.availableAvatars = [{
file: null,
data: null,
@@ -222,9 +224,8 @@ app.controller('StepController', ['$scope', '$route', '$location', 'Wizard', fun
app.controller('FinishController', ['$scope', '$location', 'Wizard', 'Client', function ($scope, $location, Wizard, Client) {
$scope.wizard = Wizard;
$scope.setupToken = null;
Client.createAdmin($scope.wizard.username, $scope.wizard.password, $scope.wizard.email, $scope.setupToken, function (error) {
Client.createAdmin(Wizard.username, Wizard.password, Wizard.email, Wizard.setupToken, function (error) {
if (error) {
console.error('Internal error', error);
window.location.href = '/error.html';
@@ -280,13 +281,16 @@ app.controller('SetupController', ['$scope', '$location', 'Client', 'Wizard', fu
Wizard.dnsConfig = null;
}
$scope.setupToken = search.setupToken;
Wizard.setupToken = search.setupToken;
Wizard.provider = status.provider;
Wizard.email = search.email;
// angular ng-attr is only false when 'undefined'
Wizard.requireEmail = search.email || undefined;
}
Wizard.provider = status.provider;
$location.path('/step1');
$scope.initialized = true;

View File

@@ -38,13 +38,13 @@
<body class="setup" ng-app="Application" ng-controller="SetupController">
<center ng-show="!setupToken">
<center ng-show="wizard.provider === 'caas' && !setupToken">
<h1> <i class="fa fa-frown-o fa-fw text-danger"></i> No setup token provided. </h1>
Please use the setup link for this cloudron.
</center>
<div class="main-container">
<div class="row" ng-show="initialized && !busy && setupToken">
<div class="row" ng-show="initialized && !busy && !(wizard.provider === 'caas' && !setupToken)">
<div class="col-md-8 col-md-offset-2">
<div class="card" style="max-width: none; padding: 20px;">
<form role="form" name="setup_form" novalidate>