If we have an error on entry page parsing the client or validating the client tag we should show unauthorized and log the error.
This commit is contained in:
parent
ea5836b3e4
commit
86e5ac4630
1 changed files with 37 additions and 30 deletions
|
|
@ -34,44 +34,51 @@ export default {
|
|||
computed: {
|
||||
},
|
||||
async mounted() {
|
||||
const queryStringParams = this.parseQueryParms();
|
||||
|
||||
const { isAuthorized, clientData, decryptedParams } = await this.validateClientTagOnEntry(queryStringParams);
|
||||
|
||||
this.unauthorized = !isAuthorized;
|
||||
if (!isAuthorized) {
|
||||
// Remove the loading animation if client tag validation fails so users can see the Unauthorized Access message.
|
||||
showIssLoadingModal(false);
|
||||
return;
|
||||
}
|
||||
|
||||
this.populateISSConfigValues(clientData);
|
||||
|
||||
try {
|
||||
// Check cookie
|
||||
const issCookie = getISSCookie();
|
||||
if (issCookie !== null && issCookie.VehicleMake && issCookie.VehicleModel) {
|
||||
const clientParentAccountNumber = clientData.parentAccountNumber;
|
||||
const cookieParentAccountNumber = issCookie.ReferralParentAccountNumber;
|
||||
const queryStringParams = this.parseQueryParms();
|
||||
|
||||
if (clientParentAccountNumber === cookieParentAccountNumber) {
|
||||
const savedSessionTimeStamp = new Date(issCookie.SavedSessionTimeoutDate);
|
||||
const isSavedSessionTimedOut = new Date(new Date().toUTCString()) > savedSessionTimeStamp;
|
||||
const { isAuthorized, clientData, decryptedParams } = await this.validateClientTagOnEntry(queryStringParams);
|
||||
|
||||
if (!isSavedSessionTimedOut) {
|
||||
this.mainStore.issConfig.enableContinueFromCookie = true;
|
||||
this.unauthorized = !isAuthorized;
|
||||
if (!isAuthorized) {
|
||||
// Remove the loading animation if client tag validation fails so users can see the Unauthorized Access message.
|
||||
showIssLoadingModal(false);
|
||||
return;
|
||||
}
|
||||
|
||||
this.populateISSConfigValues(clientData);
|
||||
|
||||
try {
|
||||
// Check cookie
|
||||
const issCookie = getISSCookie();
|
||||
if (issCookie !== null && issCookie.VehicleMake && issCookie.VehicleModel) {
|
||||
const clientParentAccountNumber = clientData.parentAccountNumber;
|
||||
const cookieParentAccountNumber = issCookie.ReferralParentAccountNumber;
|
||||
|
||||
if (clientParentAccountNumber === cookieParentAccountNumber) {
|
||||
const savedSessionTimeStamp = new Date(issCookie.SavedSessionTimeoutDate);
|
||||
const isSavedSessionTimedOut = new Date(new Date().toUTCString()) > savedSessionTimeStamp;
|
||||
|
||||
if (!isSavedSessionTimedOut) {
|
||||
this.mainStore.issConfig.enableContinueFromCookie = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
updateOrCreateISSCookie(true);
|
||||
}
|
||||
} else {
|
||||
} catch {
|
||||
updateOrCreateISSCookie(true);
|
||||
}
|
||||
} catch {
|
||||
updateOrCreateISSCookie(true);
|
||||
}
|
||||
|
||||
if (clientData.parameters?.length > 0) {
|
||||
const finalParams = this.combineClientParameters(clientData.parameters, { ...queryStringParams, ...decryptedParams });
|
||||
this.populateStoreItemsFromParams(finalParams);
|
||||
if (clientData.parameters?.length > 0) {
|
||||
const finalParams = this.combineClientParameters(clientData.parameters, { ...queryStringParams, ...decryptedParams });
|
||||
this.populateStoreItemsFromParams(finalParams);
|
||||
}
|
||||
} catch (e) {
|
||||
global.$logger.logError('[Entry Page] Client Setup Error:', e);
|
||||
this.unauthorized = true;
|
||||
showIssLoadingModal(false);
|
||||
return;
|
||||
}
|
||||
|
||||
this.mainStore.applicationUser.coverageAttempts = 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue