Setting the appstore config also deals with appstore registration

- First time it registers the cloudron
- Resetting the account will verify that the Cloudron belongs to this user
- If cloudronId is invalid/unknown we reregister
This commit is contained in:
Johannes Zellner
2016-08-01 15:10:45 +02:00
parent d5644ae3f1
commit 1f1237e785
3 changed files with 166 additions and 6 deletions

View File

@@ -186,9 +186,14 @@ function setAppstoreConfig(req, res, next) {
settings.setAppstoreConfig(options, function (error) {
if (error && error.reason === SettingsError.BAD_FIELD) return next(new HttpError(400, error.message));
if (error && error.reason === SettingsError.EXTERNAL_ERROR) return next(new HttpError(406, error.message));
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(200));
settings.getAppstoreConfig(function (error, result) {
if (error) return next(new HttpError(500, error));
next(new HttpSuccess(202, result));
});
});
}