eCourt-Doc-Edit/web/app/components/AuthGate.vue

25 lines
1.2 KiB
Vue
Raw Normal View History

2026-08-20 06:20:16 +07:00
<script setup lang="ts">
/** ครอบเนื้อหาหน้าที่ต้อง login — ยังไม่พร้อมแสดง spinner, ยังไม่ login แสดงปุ่มเข้าระบบ */
const { ready, isAuthenticated, login } = useAuth()
</script>
<template>
2026-08-20 21:34:45 +07:00
<div v-if="!ready" class="flex items-center justify-center gap-3 py-16 text-sm text-muted">
<span class="spinner" />
2026-08-20 06:20:16 +07:00
กำลังตรวจสอบสถานะการเข้าสู่ระบบ…
</div>
2026-08-20 21:34:45 +07:00
<div v-else-if="!isAuthenticated" class="card mx-auto max-w-md p-8 text-center">
<h2 class="text-section-title">ต้องเข้าสู่ระบบก่อนใช้งานหน้านี้</h2>
<p class="mt-2 text-body-lg text-muted">
2026-08-20 06:20:16 +07:00
ระบบยืนยันตัวตนผ่าน Keycloak (realm <span class="font-mono">word-versioning</span>)
— กดปุ่มด้านล่างเพื่อเปิดหน้าเข้าสู่ระบบ
</p>
2026-08-20 21:34:45 +07:00
<button type="button" class="btn btn-primary mt-6 w-full sm:w-auto" @click="login()">
2026-08-20 06:20:16 +07:00
เข้าสู่ระบบด้วย Keycloak
</button>
</div>
<slot v-else />
</template>