Fix for missing pre-populated fields upon successful client signature validation.
This commit is contained in:
parent
790672ee19
commit
d2f9ea3bea
1 changed files with 45 additions and 8 deletions
|
|
@ -130,15 +130,27 @@ export default {
|
|||
let isAuthorized = false;
|
||||
let clientData = null;
|
||||
const decryptedParams = {};
|
||||
const encryptedParametersPattern = this.mainStore.issConfig.encryptedParametersPattern;
|
||||
console.log("Encrypted Parameters Pattern from config: ", encryptedParametersPattern);
|
||||
|
||||
if (resp.active && resp.accountName.length > 0) {
|
||||
if (resp.authentication.startsWith('RSAToken')) {
|
||||
const { token, signature } = queryStringParams;
|
||||
const vsigResp = await validateISSClientSignature(clientTag, token, signature);
|
||||
if (resp.authentication.includes('EncParams')) {
|
||||
const params = new URLSearchParams(vsigResp.decryptedData);
|
||||
for (const [key, value] of params) {
|
||||
decryptedParams[key.toLowerCase()] = value;
|
||||
|
||||
if (resp.authentication.includes('EncParams') && encryptedParametersPattern) {
|
||||
try {
|
||||
const match = vsigResp.decryptedData.match(encryptedParametersPattern);
|
||||
|
||||
if ( match ) {
|
||||
const params = match.groups;
|
||||
for (const [key, value] of Object.entries(params)) {
|
||||
decryptedParams[key.toLowerCase()] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( error ) {
|
||||
global.$logger.logError(`[Entry Page] Unable to populate encrypted parameters: ${error} - Client Tag: ${clientTag} - Token: ${token} - Signature: ${signature}`);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -197,6 +209,10 @@ export default {
|
|||
if (clientFlags.EnableNoCompQuote) {
|
||||
this.mainStore.issConfig.enableNoCompQuote = true;
|
||||
}
|
||||
|
||||
if ( clientFlags.EncryptedParametersPattern != null ) {
|
||||
this.mainStore.issConfig.encryptedParametersPattern = clientFlags.EncryptedParametersPattern;
|
||||
}
|
||||
}
|
||||
},
|
||||
combineClientParameters(configParams, queryStringParams) {
|
||||
|
|
@ -233,10 +249,14 @@ export default {
|
|||
break;
|
||||
|
||||
case 'dateofloss':
|
||||
case 'lossdate':
|
||||
// NOTE: May need some date parsing logic in here depending on client.
|
||||
this.mainStore.order.policy.dateOfLoss = value;
|
||||
this.mainStore.issConfig.disabledFields.dateOfLoss = true;
|
||||
case 'lossdate':
|
||||
const formattedDate = this.formatToYYYYMMDD(value);
|
||||
|
||||
// Only set this if it formatted correctly.
|
||||
if ( formattedDate ) {
|
||||
this.mainStore.order.policy.dateOfLoss = formattedDate;
|
||||
this.mainStore.issConfig.disabledFields.dateOfLoss = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'returnurl':
|
||||
|
|
@ -257,6 +277,23 @@ export default {
|
|||
default:
|
||||
}
|
||||
}
|
||||
},
|
||||
formatToYYYYMMDD(dateString) {
|
||||
var returnValue = null;
|
||||
|
||||
try {
|
||||
const date = new Date(dateString);
|
||||
|
||||
const year = date.getFullYear();
|
||||
const month = String(date.getMonth() + 1).padStart(2, "0");
|
||||
const day = String(date.getDate()).padStart(2, "0");
|
||||
|
||||
returnValue = `${year}-${month}-${day}`;
|
||||
} catch ( error ) {
|
||||
global.$logger.logError(`[Entry Page] Error formatting date string: ${error} - Input: ${dateString}`);
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue