DigitalConsumer.ISS/src/layouts/entry-page/entry-page.vue
2023-02-23 17:05:27 -05:00

74 lines
2.2 KiB
Vue

<template>
<p id="message" v-show="unauthorized">Unauthorized Access.</p>
</template>
<script>
// Supporting files
import { issPageValues } from "@/router/router-constants/issPage-values";
import { validateISSClientTag } from "@/helpers/clientauth-helper";
import { useMainStore } from '@/store';
export default {
name: "entry-page",
mixins: [],
data() {
return {
unauthorized: false,
}
},
setup() {
const mainStore = useMainStore();
mainStore.resetISSConfigState();
return { mainStore };
},
mounted() {
this.validateClientTagOnEntry();
},
methods:
{
navigateForward() {
this.$router.navigate(
this.navigationScenarios.MOVE_FORWARD_ENTRY_PAGE,
this.$route
);
},
async validateClientTagOnEntry() {
const clientTag = this.$route.query.ClientTag;
const clientTagPresent = !!clientTag;
let authorized = false;
if ( clientTagPresent )
{
const resp = await validateISSClientTag(clientTag);
if ( resp?.data.active && resp?.data.accountName.length > 0 )
{
this.mainStore.issConfig.clientName = resp.data.accountName;
this.mainStore.issConfig.accountNumber = resp.data.accountNumber;
this.mainStore.issConfig.styleSheet = resp.data.styleSheet;
authorized = true;
}
}
this.unauthorized = !authorized;
if ( authorized )
{
// Forced full location redirect here. We do not want the entry page as part of the router/flow/path history.
window.location = "/?issPage=" + issPageValues.WELCOME_PAGE;
}
},
},
computed:{
},
components: {
},
}
</script>
<style lang="scss">
#message {
text-align: center;
}
</style>