diff --git a/dashboard/src/js/passwordreset.js b/dashboard/src/js/passwordreset.js index 6debd1cdb..586f7233f 100644 --- a/dashboard/src/js/passwordreset.js +++ b/dashboard/src/js/passwordreset.js @@ -65,7 +65,7 @@ app.controller('PasswordResetController', ['$scope', '$translate', '$http', func $scope.mode = ''; $scope.busy = false; $scope.error = false; - $scope.status = null; + $scope.branding = null; $scope.username = ''; $scope.password = ''; $scope.totpToken = ''; @@ -132,14 +132,14 @@ app.controller('PasswordResetController', ['$scope', '$translate', '$http', func setTimeout(function () { $('#inputNewPassword').focus(); }, 200); }; - $http.get(API_ORIGIN + '/api/v1/cloudron/status').success(function (data, status) { + $http.get(API_ORIGIN + '/api/v1/auth/branding').success(function (data, status) { $scope.initialized = true; if (status !== 200) return; if (data.language) $translate.use(data.language); - $scope.status = data; + $scope.branding = data; }).error(function () { $scope.initialized = false; }); diff --git a/dashboard/src/js/setupaccount.js b/dashboard/src/js/setupaccount.js index 093aba868..65ecd34a2 100644 --- a/dashboard/src/js/setupaccount.js +++ b/dashboard/src/js/setupaccount.js @@ -70,7 +70,7 @@ app.controller('SetupAccountController', ['$scope', '$translate', '$http', funct $scope.busy = false; $scope.error = null; $scope.view = 'setup'; - $scope.status = null; + $scope.branding = null; $scope.profileLocked = !!search.profileLocked; $scope.existingUsername = !!search.username; @@ -133,14 +133,14 @@ app.controller('SetupAccountController', ['$scope', '$translate', '$http', funct $scope.view = 'noUsername'; $scope.initialized = true; } else { - $http.get(API_ORIGIN + '/api/v1/cloudron/status').success(function (data, status) { + $http.get(API_ORIGIN + '/api/v1/auth/branding').success(function (data, status) { $scope.initialized = true; if (status !== 200) return; if (data.language) $translate.use(data.language); - $scope.status = data; + $scope.branding = data; }).error(function () { $scope.initialized = false; }); diff --git a/dashboard/src/passwordreset.html b/dashboard/src/passwordreset.html index c7c6c8907..fe268778e 100644 --- a/dashboard/src/passwordreset.html +++ b/dashboard/src/passwordreset.html @@ -160,7 +160,7 @@ diff --git a/dashboard/src/setupaccount.html b/dashboard/src/setupaccount.html index 555147953..91f09e4a3 100644 --- a/dashboard/src/setupaccount.html +++ b/dashboard/src/setupaccount.html @@ -58,7 +58,7 @@

-

{{ 'setupAccount.welcomeTo' | tr }} {{ status.cloudronName || 'Cloudron' }}

+

{{ 'setupAccount.welcomeTo' | tr }} {{ branding.cloudronName || 'Cloudron' }}

{{ 'setupAccount.description' | tr }}

@@ -154,7 +154,7 @@ diff --git a/src/cloudron.js b/src/cloudron.js index c47b45416..f55d57c92 100644 --- a/src/cloudron.js +++ b/src/cloudron.js @@ -134,9 +134,6 @@ async function runStartupTasks() { async function getStatus() { return { version: constants.VERSION, - cloudronName: await branding.getCloudronName(), // still used in passwordreset and setupaccount views - footer: await branding.renderFooter(), // still used in passwordreset and setupaccount views - language: await getLanguage(), // still used in passwordreset and setupaccount views }; } diff --git a/src/routes/auth.js b/src/routes/auth.js index 756228e64..74978b264 100644 --- a/src/routes/auth.js +++ b/src/routes/auth.js @@ -6,11 +6,14 @@ exports = module.exports = { passwordResetRequest, passwordReset, setupAccount, + getBranding }; const assert = require('assert'), AuditSource = require('../auditsource.js'), BoxError = require('../boxerror.js'), + branding = require('../branding.js'), + cloudron = require('../cloudron.js'), constants = require('../constants.js'), debug = require('debug')('box:routes/cloudron'), eventlog = require('../eventlog.js'), @@ -115,3 +118,15 @@ async function setupAccount(req, res, next) { next(new HttpSuccess(201, { accessToken })); } + +async function getBranding(req, res, next) { + // still used in passwordreset and setupaccount views. we should server render them + const result = { + cloudronName: await branding.getCloudronName(), + footer: await branding.renderFooter(), + language: await cloudron.getLanguage(), + }; + + next(new HttpSuccess(200, result)); + +} \ No newline at end of file diff --git a/src/server.js b/src/server.js index 5c13cdecb..1e338f6df 100644 --- a/src/server.js +++ b/src/server.js @@ -105,8 +105,9 @@ async function initializeExpressSync() { router.post('/api/v1/auth/password_reset_request', json, routes.auth.passwordResetRequest); router.post('/api/v1/auth/password_reset', json, routes.auth.passwordReset); router.post('/api/v1/auth/setup_account', json, routes.auth.setupAccount); + router.post('/api/v1/auth/branding', routes.auth.getBranding); // temp route until we server side render password_reset and setup_account - // config route (for dashboard). can return some private configuration unlike status + // config route for dashboard that any auth user (not just admin) can access router.get ('/api/v1/config', token, authorizeUser, routes.cloudron.getConfig); router.get ('/api/v1/platform_status', token, authorizeUser, routes.cloudron.getPlatformStatus);