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 isAuthorized = false;
|
||||||
let clientData = null;
|
let clientData = null;
|
||||||
const decryptedParams = {};
|
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.active && resp.accountName.length > 0) {
|
||||||
if (resp.authentication.startsWith('RSAToken')) {
|
if (resp.authentication.startsWith('RSAToken')) {
|
||||||
const { token, signature } = queryStringParams;
|
const { token, signature } = queryStringParams;
|
||||||
const vsigResp = await validateISSClientSignature(clientTag, token, signature);
|
const vsigResp = await validateISSClientSignature(clientTag, token, signature);
|
||||||
if (resp.authentication.includes('EncParams')) {
|
|
||||||
const params = new URLSearchParams(vsigResp.decryptedData);
|
if (resp.authentication.includes('EncParams') && encryptedParametersPattern) {
|
||||||
for (const [key, value] of params) {
|
try {
|
||||||
decryptedParams[key.toLowerCase()] = value;
|
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) {
|
if (clientFlags.EnableNoCompQuote) {
|
||||||
this.mainStore.issConfig.enableNoCompQuote = true;
|
this.mainStore.issConfig.enableNoCompQuote = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( clientFlags.EncryptedParametersPattern != null ) {
|
||||||
|
this.mainStore.issConfig.encryptedParametersPattern = clientFlags.EncryptedParametersPattern;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
combineClientParameters(configParams, queryStringParams) {
|
combineClientParameters(configParams, queryStringParams) {
|
||||||
|
|
@ -233,10 +249,14 @@ export default {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'dateofloss':
|
case 'dateofloss':
|
||||||
case 'lossdate':
|
case 'lossdate':
|
||||||
// NOTE: May need some date parsing logic in here depending on client.
|
const formattedDate = this.formatToYYYYMMDD(value);
|
||||||
this.mainStore.order.policy.dateOfLoss = value;
|
|
||||||
this.mainStore.issConfig.disabledFields.dateOfLoss = true;
|
// Only set this if it formatted correctly.
|
||||||
|
if ( formattedDate ) {
|
||||||
|
this.mainStore.order.policy.dateOfLoss = formattedDate;
|
||||||
|
this.mainStore.issConfig.disabledFields.dateOfLoss = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'returnurl':
|
case 'returnurl':
|
||||||
|
|
@ -257,6 +277,23 @@ export default {
|
||||||
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