Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FOUR-19236 Encryption is Not Working in Authenticated Web Entry #1735

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading