show warning in case configured baseurl differs from current url #149

This commit is contained in:
lesion 2022-04-27 12:37:45 +02:00
parent 95b546afa9
commit 4f7d3d5127
No known key found for this signature in database
GPG key ID: 352918250B012177
5 changed files with 37 additions and 35 deletions

View file

@ -230,7 +230,8 @@
"smtp_test_success": "A test email is sent to {admin_email}, please check your inbox", "smtp_test_success": "A test email is sent to {admin_email}, please check your inbox",
"smtp_test_button": "Send a test email", "smtp_test_button": "Send a test email",
"admin_email": "Admin e-mail", "admin_email": "Admin e-mail",
"widget": "Widget" "widget": "Widget",
"wrong_domain_warning": "The baseurl configured in config.json <b>({baseurl})</b> differs from the one you're visiting <b>({url})</b>"
}, },
"auth": { "auth": {
"not_confirmed": "Not confirmed yet…", "not_confirmed": "Not confirmed yet…",
@ -277,6 +278,7 @@
"completed": "Setup completed", "completed": "Setup completed",
"completed_description": "<p>You can now login with the following user:<br/><br/>User: <b>{email}</b><br/>Password: <b>{password}<b/></p>", "completed_description": "<p>You can now login with the following user:<br/><br/>User: <b>{email}</b><br/>Password: <b>{password}<b/></p>",
"copy_password_dialog": "Yes, you have to copy the password!", "copy_password_dialog": "Yes, you have to copy the password!",
"start": "Start" "start": "Start",
"https_warning": "You're visiting from HTTP, remember to change baseurl in config.json if you switch to HTTPS!"
} }
} }

View file

@ -277,6 +277,7 @@
"completed": "Setup completato", "completed": "Setup completato",
"completed_description": "<p>Puoi entrare con le seguenti credenziali:<br/><br/>Utente: <b>{email}</b><br/>Password: <b>{password}<b/></p>", "completed_description": "<p>Puoi entrare con le seguenti credenziali:<br/><br/>Utente: <b>{email}</b><br/>Password: <b>{password}<b/></p>",
"copy_password_dialog": "Sì, devi copiare la password!", "copy_password_dialog": "Sì, devi copiare la password!",
"start": "Inizia" "start": "Inizia",
"https_warning": "Stai visitando il setup da HTTP, ricorda di cambiare il baseurl nel config.json quando passarai ad HTTPS!"
} }
} }

View file

@ -1,7 +1,7 @@
<template lang="pug"> <template lang="pug">
v-container.container.pa-0.pa-md-3 v-container.container.pa-0.pa-md-3
v-card v-card
v-alert(v-if='url!==settings.baseurl' outlined type='warning' color='red' show-icon :icon='mdiAlert') {{$t('admin.wrong_domain_warning')}} v-alert(v-if='url!==settings.baseurl' outlined type='warning' color='red' show-icon :icon='mdiAlert' v-html="$t('admin.wrong_domain_warning', { url, baseurl: settings.baseurl })")
v-tabs(v-model='selectedTab' show-arrows) v-tabs(v-model='selectedTab' show-arrows)
//- SETTINGS //- SETTINGS

View file

@ -1,16 +1,20 @@
<template lang="pug"> <template lang="pug">
v-container v-container
v-card-title.d-block.text-h5.text-center(v-text="$t('setup.completed')") v-card-title.d-block.text-h5.text-center(v-text="$t('setup.completed')")
v-card-text(v-html="$t('setup.completed_description', user)") v-card-text(v-html="$t('setup.completed_description', user)")
v-alert.mb-3.mt-1(outlined type='warning' color='red' show-icon :icon='mdiAlert') {{$t('setup.copy_password_dialog')}} v-alert.mb-3.mt-1(v-if='isHttp' outlined type='warning' color='red' show-icon :icon='mdiAlert') {{$t('setup.https_warning')}}
v-card-actions v-alert.mb-3.mt-1(outlined type='warning' color='red' show-icon :icon='mdiAlert') {{$t('setup.copy_password_dialog')}}
v-btn(text @click='next' color='primary' :loading='loading' :disabled='loading') {{$t('setup.start')}} v-card-actions
v-icon(v-text='mdiArrowRight') v-btn(text @click='next' color='primary' :loading='loading' :disabled='loading') {{$t('setup.start')}}
v-icon(v-text='mdiArrowRight')
</template> </template>
<script> <script>
import { mdiArrowRight, mdiAlert } from '@mdi/js' import { mdiArrowRight, mdiAlert } from '@mdi/js'
export default { export default {
props: {
isHttp: { type: Boolean, default: false },
},
data () { data () {
return { return {
mdiArrowRight, mdiAlert, mdiArrowRight, mdiAlert,

View file

@ -1,27 +1,21 @@
<template lang="pug"> <template lang="pug">
v-container.pa-6
h2.mb-2.text-center Gancio Setup
v-stepper.grey.lighten-5(v-model='step')
v-stepper-header
v-stepper-step(v-show='!dbdone' :complete='step > 1' step='1') Database
v-divider(v-show='!dbdone')
v-stepper-step(:complete='step > 2' step='2') Configuration
v-divider
v-stepper-step(:complete='step > 3' step='3') Finish
v-container.pa-6 v-stepper-items
h2.mb-2.text-center Gancio Setup v-stepper-content(v-show='!dbdone' step='1')
v-stepper.grey.lighten-5(v-model='step') DbStep(@complete='dbCompleted')
v-stepper-header v-stepper-content(step='2')
v-stepper-step(v-show='!dbdone' :complete='step > 1' step='1') Database Settings(setup, @complete='configCompleted')
v-divider(v-show='!dbdone') v-stepper-content(step='3')
v-stepper-step(:complete='step > 2' step='2') Configuration Completed(ref='completed' :isHttp='isHttp')
v-divider
v-stepper-step(:complete='step > 3' step='3') Finish
v-stepper-items
v-stepper-content(v-show='!dbdone' step='1')
DbStep(@complete='dbCompleted')
v-stepper-content(step='2')
Settings(setup, @complete='configCompleted')
v-stepper-content(step='3')
Completed(ref='completed')
</template> </template>
<script> <script>
import DbStep from './DbStep' import DbStep from './DbStep'
@ -36,9 +30,10 @@ export default {
title: 'Setup', title: 'Setup',
}, },
auth: false, auth: false,
asyncData ({ params }) { asyncData ({ params, req }) {
const protocol = process.client ? window.location.protocol : req.protocol + ':'
return { return {
isHttp: protocol === 'http:',
dbdone: !!Number(params.db), dbdone: !!Number(params.db),
config: { config: {
db: { db: {