Add logic for email setup and invite setup forms

This commit is contained in:
Johannes Zellner
2020-06-09 15:39:27 +02:00
parent ccf1c78cbb
commit a8e6d727fa
2 changed files with 136 additions and 61 deletions

View File

@@ -11,8 +11,8 @@ app.controller('SetupController', ['$scope', 'Client', function ($scope, Client)
var search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.split('='); }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {});
$scope.client = Client;
$scope.initialized = false;
$scope.busy = false;
$scope.view = '';
$scope.busy = true;
$scope.account = {
email: '',
displayName: '',
@@ -33,7 +33,7 @@ app.controller('SetupController', ['$scope', 'Client', function ($scope, Client)
$scope.busy = false;
$scope.error = { username: error.message };
$scope.account.username = '';
$scope.setupForm.username.$setPristine();
$scope.ownerForm.username.$setPristine();
setTimeout(function () { $('#inputUsername').focus(); }, 200);
return;
} else if (error) {
@@ -47,6 +47,24 @@ app.controller('SetupController', ['$scope', 'Client', function ($scope, Client)
});
};
$scope.email = {
error: null,
busy: false,
submit: function () {
}
};
$scope.invite = {
error: null,
busy: false,
submit: function () {
}
};
function redirectIfNeeded(status) {
if ('develop' in search || localStorage.getItem('develop')) {
console.warn('Cloudron develop mode on. To disable run localStorage.removeItem(\'develop\')');
@@ -72,16 +90,24 @@ app.controller('SetupController', ['$scope', 'Client', function ($scope, Client)
}
}
function setView() {
if (search.view === 'owner') $scope.view = 'owner';
else if (search.view === 'email') $scope.view = 'email';
else if (search.view === 'invite') $scope.view = 'invite';
else $scope.view = 'owner';
}
function init() {
Client.getStatus(function (error, status) {
if (error) return Client.initError(error, init);
redirectIfNeeded(status);
setView();
$scope.apiServerOrigin = status.apiServerOrigin;
$scope.webServerOrigin = status.webServerOrigin;
$scope.initialized = true;
$scope.busy = false;
// Ensure we have a good autofocus
setTimeout(function () {