diff --git a/app/pages/admin/login.vue b/app/pages/admin/login.vue index cee5233..a2e866d 100644 --- a/app/pages/admin/login.vue +++ b/app/pages/admin/login.vue @@ -22,6 +22,10 @@
Se connecter + +

+ Dev : {{ devHint }} +

@@ -34,6 +38,13 @@ definePageMeta({ const password = ref('') const error = ref('') const loading = ref(false) +const devHint = ref('') + +if (import.meta.dev) { + $fetch('/api/admin/auth/hint').then((res: any) => { + devHint.value = res.password + }).catch(() => {}) +} async function login() { error.value = '' @@ -131,4 +142,18 @@ async function login() { opacity: 0.7; cursor: wait; } + +.dev-hint { + margin-top: 1rem; + text-align: center; + font-size: 0.75rem; + color: hsl(20 8% 40%); +} + +.dev-hint code { + color: hsl(12 76% 60%); + background: hsl(20 8% 10%); + padding: 0.125rem 0.375rem; + border-radius: 0.25rem; +} diff --git a/server/api/admin/auth/hint.get.ts b/server/api/admin/auth/hint.get.ts new file mode 100644 index 0000000..55c3543 --- /dev/null +++ b/server/api/admin/auth/hint.get.ts @@ -0,0 +1,8 @@ +export default defineEventHandler(() => { + if (!import.meta.dev) { + throw createError({ statusCode: 404, statusMessage: 'Not found' }) + } + + const config = useRuntimeConfig() + return { password: config.adminPassword } +})