diff --git a/dashboard/passwordreset.html b/dashboard/passwordreset.html index e5f7ab8d1..bc3b25c78 100644 --- a/dashboard/passwordreset.html +++ b/dashboard/passwordreset.html @@ -17,6 +17,12 @@ } + +
diff --git a/dashboard/setupaccount.html b/dashboard/setupaccount.html index b18fc9f89..0a50597c5 100644 --- a/dashboard/setupaccount.html +++ b/dashboard/setupaccount.html @@ -17,6 +17,12 @@ } + + diff --git a/dashboard/src/components/SetupAccount.vue b/dashboard/src/components/SetupAccount.vue index 89548d10f..c26413565 100644 --- a/dashboard/src/components/SetupAccount.vue +++ b/dashboard/src/components/SetupAccount.vue @@ -2,19 +2,19 @@ import { ref, onMounted, useTemplateRef } from 'vue'; import { marked } from 'marked'; -import { Button, PasswordInput, FormGroup, TextInput, fetcher } from '@cloudron/pankow'; -import { API_ORIGIN } from '../constants.js'; +import { Button, PasswordInput, FormGroup, TextInput } from '@cloudron/pankow'; import PublicPageLayout from '../components/PublicPageLayout.vue'; import ProfileModel from '../models/ProfileModel.js'; const profileModel = ProfileModel.create(); +const footer = marked.parse(window.cloudron.footer); +const cloudronName = window.cloudron.name; + const ready = ref(false); const busy = ref(false); const formError = ref({}); const mode = ref(''); -const footer = ref(''); -const cloudronName = ref(''); const form = useTemplateRef('form'); const profileLocked = ref(false); const existingUsername = ref(false); @@ -83,14 +83,6 @@ async function onSubmit() { onMounted(async () => { const search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.indexOf('=') === -1 ? [item, true] : [item.slice(0, item.indexOf('=')), item.slice(item.indexOf('=')+1)]; }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {}); - try { - const res = await fetcher.get(`${API_ORIGIN}/api/v1/auth/branding`); - footer.value = marked.parse(res.body.footer); - cloudronName.value = res.body.cloudronName; - } catch (error) { - console.error('Failed to get branding info.', error); - } - profileLocked.value = !!search.profileLocked; existingUsername.value = !!search.username; username.value = search.username || ''; diff --git a/dashboard/src/views/PasswordResetView.vue b/dashboard/src/views/PasswordResetView.vue index 429e74257..46ac7f07a 100644 --- a/dashboard/src/views/PasswordResetView.vue +++ b/dashboard/src/views/PasswordResetView.vue @@ -6,12 +6,13 @@ import { Button, PasswordInput, TextInput, fetcher, FormGroup } from '@cloudron/ import { API_ORIGIN } from '../constants.js'; import PublicPageLayout from '../components/PublicPageLayout.vue'; +const footer = marked.parse(window.cloudron.footer); +const cloudronName = window.cloudron.name; + const ready = ref(false); const busy = ref(false); const error = ref({}); const mode = ref(''); -const footer = ref(''); -const cloudronName = ref(''); const resetToken = ref(''); const passwordResetIdentifier = ref(''); const newPassword = ref(''); @@ -78,14 +79,6 @@ async function onNewPassword() { onMounted(async () => { const search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.indexOf('=') === -1 ? [item, true] : [item.slice(0, item.indexOf('=')), item.slice(item.indexOf('=')+1)]; }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {}); - try { - const res = await fetcher.get(`${API_ORIGIN}/api/v1/auth/branding`); - footer.value = marked.parse(res.body.footer); - cloudronName.value = res.body.cloudronName; - } catch (error) { - console.error('Failed to get branding info.', error); - } - // Init into the correct view if (search.resetToken) { resetToken.value = search.resetToken; diff --git a/src/routes/dashboard.js b/src/routes/dashboard.js index 0963870e7..39fcda4cd 100644 --- a/src/routes/dashboard.js +++ b/src/routes/dashboard.js @@ -89,7 +89,9 @@ async function renderPasswordreset(req, res) { const template = fs.readFileSync(path.join(paths.DASHBOARD_DIR, 'passwordreset.html'), 'utf-8'); const cloudronName = await branding.getCloudronName(); - const html = ejs.render(template, { cloudronName }); + const footer = await branding.renderFooter(); + + const html = ejs.render(template, { cloudronName, footer }); res.send(html); } @@ -98,7 +100,9 @@ async function renderSetupaccount(req, res) { const template = fs.readFileSync(path.join(paths.DASHBOARD_DIR, 'setupaccount.html'), 'utf-8'); const cloudronName = await branding.getCloudronName(); - const html = ejs.render(template, { cloudronName }); + const footer = await branding.renderFooter(); + + const html = ejs.render(template, { cloudronName, footer }); res.send(html); }