Do not call onActivated when not activated

regression caused by ba29889f54
This commit is contained in:
Girish Ramakrishnan
2020-09-01 15:35:34 -07:00
parent 9ae4ce82a7
commit 6f188da2a6

View File

@@ -78,6 +78,7 @@ function onActivated(callback) {
// 1. mail bounces can now be sent to the cloudron owner
// 2. the restore code path can run without sudo (since mail/ is non-root)
async.series([
reverseProxy.removeDefaultConfig, // remove IP based nginx config once user is created
platform.start,
cron.startJobs,
function checkBackupConfiguration(callback) {
@@ -125,15 +126,13 @@ function runStartupTasks() {
// check activation state and start the platform
users.isActivated(function (error, activated) {
if (error) return debug(error);
// configure nginx to be reachable by IP when not activated. for the moment, the IP based redirect exists even after domain is setup
// just in case user forgot or some network error happenned in the middle (then browser refresh takes you to activation page)
// we remove the config as a simple security measure to not expose IP <-> domain
if (!activated) {
debug('runStartupTasks: generating IP based redirection config');
reverseProxy.writeDefaultConfig(NOOP_CALLBACK);
} else {
debug('runStartupTasks: removing IP based redirection config');
reverseProxy.removeDefaultConfig(NOOP_CALLBACK);
debug('runStartupTasks: not activated. generating IP based redirection config');
return reverseProxy.writeDefaultConfig(NOOP_CALLBACK);
}
onActivated(NOOP_CALLBACK);