Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions src/components/authz/UnauthorizedHandler.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<script setup lang="ts">
import {
onMounted,
onUnmounted,
ref
} from 'vue';
import {
auth
} from '@janishutz/oidc-login-sdk-browser';

const showReauthPopup = ref( false );

const reauth = () => {
auth.loginInNewTab();
showReauthPopup.value = false;
};

const reauthListenerHandler = () => {
showReauthPopup.value = true;
};

const cancelReauth = () => {
showReauthPopup.value = false;
location.href = '/';
};

onMounted( () => {
document.addEventListener( 'autherror', reauthListenerHandler );
} );

onUnmounted( () => {
try {
document.removeEventListener( 'autherror', reauthListenerHandler );
} catch { /* empty */ }
} );
</script>

<template>
<v-dialog
v-model="showReauthPopup"
width="auto"
>
<v-card
max-width="400"
prepend-icon="mdi-logout"
text="You have become unauthorized for some reason. Please click the button below to log in again"
title="Logged out"
>
<template #actions>
<v-btn
class=""
text="Cancel"
@click="cancelReauth"
/>
<v-btn
class="text-weight-bold"
text="Login again"
@click="reauth"
/>
</template>
</v-card>
</v-dialog>
</template>
Loading