11<template >
22 <div class =" flex items-center justify-center min-h-screen" >
3- <Spinner />
3+ <div v-if =" error" class =" py-8 px-4 mx-auto max-w-screen-xl lg:py-16 lg:px-6" >
4+ <div class =" mx-auto max-w-screen-sm text-center" >
5+ <h1 class =" mb-4 text-7xl tracking-tight font-extrabold lg:text-9xl text-lightPrimary dark:text-darkPrimary" >
6+ Oops!
7+ </h1 >
8+ <p class =" mb-4 text-3xl tracking-tight font-bold text-gray-900 md:text-4xl dark:text-white" >
9+ Authentication Failed
10+ </p >
11+ <p class =" mb-4 text-lg font-light text-gray-500 dark:text-gray-400" >
12+ {{ error }}
13+ </p >
14+ <div class =" flex justify-center" >
15+ <LinkButton to =" /login" >Back to Login</LinkButton >
16+ </div >
17+ </div >
18+ </div >
19+ <Spinner v-else />
420 </div >
521</template >
622
723<script setup>
8- import { onMounted } from ' vue' ;
24+ import { onMounted , ref } from ' vue' ;
925import { useUserStore } from ' @/stores/user' ;
1026import { useRouter , useRoute } from ' vue-router' ;
1127import { callAdminForthApi } from ' @/utils' ;
12- import { Spinner } from ' @/afcl' ;
28+ import { Spinner , LinkButton } from ' @/afcl' ;
1329
1430const router = useRouter ();
1531const userStore = useUserStore ();
1632const route = useRoute ();
33+ const error = ref (null );
1734
1835onMounted (async () => {
1936 const urlParams = new URLSearchParams (window .location .search );
@@ -31,18 +48,16 @@ onMounted(async () => {
3148 path: ` /oauth/callback?code=${ encodedCode} &state=${ encodedState} &redirect_uri=${ redirectUri} ` ,
3249 method: ' GET' ,
3350 });
51+
3452 if (response .allowedLogin ) {
3553 await userStore .finishLogin ();
3654 } else if (response .redirectTo ) {
3755 router .push (response .redirectTo );
3856 } else if (response .error ) {
39- router .push ({
40- name: ' login' ,
41- query: { error: response .error }
42- });
57+ error .value = response .error ;
4358 }
4459 } else {
45- router . push ({ name : ' login ' }) ;
60+ error . value = ' Invalid authentication request. Missing required parameters. ' ;
4661 }
4762});
4863 </script >
0 commit comments