Add permanent 'Iniciar Sesión' button when not authenticated
Replace 'Ver Perfil' and 'Cerrar Sesión' buttons with a prominent 'Iniciar Sesión' button when user is not authenticated. The button reloads the page to trigger Authentik login redirect. This provides a more accessible way to log in compared to the toast button, which can be difficult to click. Button layout: - Authenticated: [Estado de Sesión] [Ver Perfil] [Cerrar Sesión] - Not authenticated: [Estado de Sesión] [Iniciar Sesión]
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<UCard class="w-full">
|
<UCard class="w-full">
|
||||||
<div class="flex flex-wrap gap-3">
|
<div class="flex flex-wrap gap-3">
|
||||||
<!-- Botón de estado de sesión -->
|
<!-- Botón de estado de sesión (siempre visible) -->
|
||||||
<UButton
|
<UButton
|
||||||
color="info"
|
color="info"
|
||||||
size="lg"
|
size="lg"
|
||||||
@@ -14,6 +14,8 @@
|
|||||||
Estado de Sesión
|
Estado de Sesión
|
||||||
</UButton>
|
</UButton>
|
||||||
|
|
||||||
|
<!-- Botones cuando HAY sesión -->
|
||||||
|
<template v-if="isAuthenticated">
|
||||||
<!-- Botón de perfil -->
|
<!-- Botón de perfil -->
|
||||||
<UButton
|
<UButton
|
||||||
color="primary"
|
color="primary"
|
||||||
@@ -38,10 +40,30 @@
|
|||||||
</template>
|
</template>
|
||||||
Cerrar Sesión
|
Cerrar Sesión
|
||||||
</UButton>
|
</UButton>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<!-- Botón cuando NO hay sesión -->
|
||||||
|
<template v-else>
|
||||||
|
<UButton
|
||||||
|
color="primary"
|
||||||
|
size="lg"
|
||||||
|
@click="reloadPage"
|
||||||
|
>
|
||||||
|
<template #leading>
|
||||||
|
<UIcon name="i-heroicons-arrow-right-end-on-rectangle" />
|
||||||
|
</template>
|
||||||
|
Iniciar Sesión
|
||||||
|
</UButton>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</UCard>
|
</UCard>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { logout, goToProfile, checkSessionStatus } = useAuthentik()
|
const { logout, goToProfile, checkSessionStatus, isAuthenticated } = useAuthentik()
|
||||||
|
|
||||||
|
const reloadPage = () => {
|
||||||
|
// Recargar la página para forzar redirect de Authentik al login
|
||||||
|
window.location.reload()
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user