Add support for unauthenticated users hitting the logout page

This commit is contained in:
Ciarán Ainsworth 2020-07-16 21:03:30 +01:00
parent 15369155dc
commit f3c522d520
2 changed files with 8 additions and 1 deletions

View File

@ -0,0 +1 @@
Add support for unauthenticated users hitting the logout page

View File

@ -1,13 +1,19 @@
<template> <template>
<main class="main pusher" v-title="labels.title"> <main class="main pusher" v-title="labels.title">
<section class="ui vertical stripe segment"> <section class="ui vertical stripe segment">
<div class="ui small text container"> <div v-if="$store.state.auth.authenticated" class="ui small text container">
<h2> <h2>
<translate translate-context="Content/Login/Title">Are you sure you want to log out?</translate> <translate translate-context="Content/Login/Title">Are you sure you want to log out?</translate>
</h2> </h2>
<p v-translate="{username: $store.state.auth.username}" translate-context="Content/Login/Paragraph">You are currently logged in as %{ username }</p> <p v-translate="{username: $store.state.auth.username}" translate-context="Content/Login/Paragraph">You are currently logged in as %{ username }</p>
<button class="ui button" @click="$store.dispatch('auth/logout')"><translate translate-context="Content/Login/Button.Label">Yes, log me out!</translate></button> <button class="ui button" @click="$store.dispatch('auth/logout')"><translate translate-context="Content/Login/Button.Label">Yes, log me out!</translate></button>
</div> </div>
<div v-else class="ui small text container">
<h2>
<translate translate-context="Content/Login/Title">You aren't currently logged in</translate>
</h2>
<router-link to='/login' class="ui button"><translate translate-context="Content/Login/Button.Label">Log in!</translate></router-link>
</div>
</section> </section>
</main> </main>
</template> </template>