Skip to content

Commit

Permalink
Merge pull request #1735 from ProcessMaker/FOUR-19236
Browse files Browse the repository at this point in the history
FOUR-19236 Encryption is Not Working in Authenticated Web Entry
  • Loading branch information
caleeli authored Oct 9, 2024
2 parents 7cc2935 + 6ea5bca commit 73cd50f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
21 changes: 7 additions & 14 deletions src/components/renderer/form-masked-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -244,21 +244,14 @@ export default {
componentConfigComputed() {
return JSON.parse(JSON.stringify(this.componentConfig));
},
requestId() {
const node = document.head.querySelector(`meta[name="request-id"]`);
if (node === null) {
return null;
}
return node.content;
},
mode() {
return this.$root.$children[0].mode;
},
inStandAloneMode() {
return this.mode === 'preview' && window.exampleScreens !== undefined;
},
inPreviewMode() {
return this.mode === 'preview' && this.requestId === null;
return this.mode === 'preview';
},
},
watch: {
Expand Down Expand Up @@ -412,15 +405,15 @@ export default {
if (this.inStandAloneMode || !this.inPreviewMode) {
// Build data to send
const dataToEncrypt = {
request_id: this.requestId,
uuid: uuidValidate(this.value) ? this.value : null,
field_name: this.name,
plain_text: this.localValue,
screen_id: this.$root.task?.screen?.screen_id
screen_id: this.$root.task?.screen?.screen_id || window?.PM4ConfigOverrides?.authParams?.screen_id
};
// Call endpoint to encrypt data
window.ProcessMaker.apiClient
.post("encrypted_data/encryptText", dataToEncrypt)
.post("/api/1.0/encrypted_data/encryptText", dataToEncrypt)
.then((response) => {
const v = response?.data !== undefined ? response?.data : response;
this.afterEncrypt(v);
Expand All @@ -444,14 +437,14 @@ export default {
if (this.inStandAloneMode || !this.inPreviewMode) {
// Build data to send
const dataToDecrypt = {
request_id: this.requestId,
uuid: this.value,
field_name: this.name,
screen_id: this.$root.task?.screen?.screen_id
screen_id: this.$root.task?.screen?.screen_id || window?.PM4ConfigOverrides?.authParams?.screen_id
};
// Call endpoint to decrypt data
window.ProcessMaker.apiClient
.post("encrypted_data/decryptText", dataToDecrypt)
.post("/api/1.0/encrypted_data/decryptText", dataToDecrypt)
.then((response) => {
const v = response?.data !== undefined ? response?.data : response;
this.afterDecrypt(v);
Expand Down
4 changes: 2 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ window.ProcessMaker = {
}
});
break;
case "encrypted_data/encryptText":
case "/api/1.0/encrypted_data/encryptText":
resolve("62abf17e-d1a6-4f68-a382-ed63872d29b0");
break;
case "encrypted_data/decryptText":
case "/api/1.0/encrypted_data/decryptText":
resolve("Secret Value");
break;
default:
Expand Down

0 comments on commit 73cd50f

Please sign in to comment.