- Add 2 dark palettes (Nuit, Ocean) to DisplaySettings with full SVG theme tokens — all hardcoded SVG colors (grids, legends, text fills, pills, dot strokes, drag handles) replaced with reactive bindings - Update scoped CSS to use var(--color-*) and var(--svg-*) throughout - Add Woodpecker CI pipeline (.woodpecker.yml): build → docker push → deploy - Add multi-stage Dockerfiles for backend (Python) and frontend (Nuxt) - Add production docker-compose with Traefik labels + dev override - Remove old single-stage Dockerfiles and root docker-compose.yml - Update Makefile with docker-dev target - Exclude data files (pdf, xls, ipynb) from git Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
71 lines
2.2 KiB
Vue
71 lines
2.2 KiB
Vue
<template>
|
|
<div style="max-width: 420px; margin: 2rem auto;">
|
|
<div class="card">
|
|
<h2 style="margin-bottom: 0.5rem;">Espace commune</h2>
|
|
<p style="color: var(--color-text-muted); margin-bottom: 1.5rem; font-size: 0.875rem;">
|
|
Connectez-vous pour gérer les données de votre commune.
|
|
</p>
|
|
|
|
<div v-if="error" class="alert alert-error">{{ error }}</div>
|
|
|
|
<form @submit.prevent="login">
|
|
<div class="form-group">
|
|
<label>Email</label>
|
|
<input v-model="email" type="email" class="form-input" placeholder="contact@mairie.fr" required />
|
|
</div>
|
|
<div class="form-group">
|
|
<label>Mot de passe</label>
|
|
<input v-model="password" type="password" class="form-input" required />
|
|
</div>
|
|
<button type="submit" class="btn btn-primary" :disabled="loading" style="width: 100%;">
|
|
<span v-if="loading" class="spinner" style="width: 1rem; height: 1rem;"></span>
|
|
<span v-else>Se connecter</span>
|
|
</button>
|
|
</form>
|
|
|
|
<!-- Dev credentials hint -->
|
|
<div v-if="isDev" class="dev-hint">
|
|
<strong>Dev:</strong> saou@sejeteralo.fr / saou2024
|
|
</div>
|
|
</div>
|
|
|
|
<p style="text-align: center; margin-top: 1rem;">
|
|
<NuxtLink to="/">← Retour à l'accueil</NuxtLink>
|
|
</p>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const authStore = useAuthStore()
|
|
const router = useRouter()
|
|
const api = useApi()
|
|
|
|
const email = ref('')
|
|
const password = ref('')
|
|
const error = ref('')
|
|
const loading = ref(false)
|
|
const isDev = import.meta.dev
|
|
|
|
async function login() {
|
|
error.value = ''
|
|
loading.value = true
|
|
try {
|
|
const data = await api.post<{ access_token: string; role: string; commune_slug: string | null }>(
|
|
'/auth/admin/login',
|
|
{ email: email.value, password: password.value },
|
|
)
|
|
authStore.setAuth(data.access_token, data.role, data.commune_slug || undefined)
|
|
|
|
if (data.commune_slug) {
|
|
router.push(`/admin/communes/${data.commune_slug}`)
|
|
} else {
|
|
router.push('/admin')
|
|
}
|
|
} catch (e: any) {
|
|
error.value = e.message || 'Erreur de connexion'
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
</script>
|