Change button layout to show all 4 buttons at the same time: - Estado de Sesión (info/blue) - Ver Perfil (primary/blue) - Cerrar Sesión (error/red) - Iniciar Sesión (success/green) - NEW: always visible This allows users to force a re-authentication by clicking 'Iniciar Sesión' even when already authenticated, triggering Authentik login flow.
65 lines
1.5 KiB
Vue
65 lines
1.5 KiB
Vue
<template>
|
|
<UCard class="w-full">
|
|
<div class="flex flex-wrap gap-3">
|
|
<!-- Botón de estado de sesión -->
|
|
<UButton
|
|
color="info"
|
|
size="lg"
|
|
variant="soft"
|
|
@click="checkSessionStatus"
|
|
>
|
|
<template #leading>
|
|
<UIcon name="i-heroicons-information-circle" />
|
|
</template>
|
|
Estado de Sesión
|
|
</UButton>
|
|
|
|
<!-- Botón de perfil -->
|
|
<UButton
|
|
color="primary"
|
|
size="lg"
|
|
@click="goToProfile"
|
|
>
|
|
<template #leading>
|
|
<UIcon name="i-heroicons-user-circle" />
|
|
</template>
|
|
Ver Perfil
|
|
</UButton>
|
|
|
|
<!-- Botón de logout -->
|
|
<UButton
|
|
color="error"
|
|
size="lg"
|
|
variant="soft"
|
|
@click="logout"
|
|
>
|
|
<template #leading>
|
|
<UIcon name="i-heroicons-arrow-right-on-rectangle" />
|
|
</template>
|
|
Cerrar Sesión
|
|
</UButton>
|
|
|
|
<!-- Botón de iniciar sesión (siempre visible) -->
|
|
<UButton
|
|
color="success"
|
|
size="lg"
|
|
@click="reloadPage"
|
|
>
|
|
<template #leading>
|
|
<UIcon name="i-heroicons-arrow-right-end-on-rectangle" />
|
|
</template>
|
|
Iniciar Sesión
|
|
</UButton>
|
|
</div>
|
|
</UCard>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
const { logout, goToProfile, checkSessionStatus, isAuthenticated } = useAuthentik()
|
|
|
|
const reloadPage = () => {
|
|
// Recargar la página para forzar redirect de Authentik al login
|
|
window.location.reload()
|
|
}
|
|
</script>
|