Skip to content

Commit

Permalink
[IMP] sign_biometric_oca: Encrypt data
Browse files Browse the repository at this point in the history
  • Loading branch information
etobella committed Aug 25, 2024
1 parent a432f0d commit d7cbc9c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 14 deletions.
4 changes: 2 additions & 2 deletions sign_biometric_oca/models/sign_oca_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class SignOcaRequestSigner(models.Model):
def _get_pdf_page_biometric(self, item, box):
packet = BytesIO()
can = canvas.Canvas(packet, pagesize=(box.getWidth(), box.getHeight()))

Check warning on line 20 in sign_biometric_oca/models/sign_oca_request.py

View check run for this annotation

Codecov / codecov/patch

sign_biometric_oca/models/sign_oca_request.py#L19-L20

Added lines #L19 - L20 were not covered by tests
if not item.get("value") or not item["value"].get("svg"):
if not item.get("value"):
return False
drawing = svg2rlg(BytesIO(b64decode(item["value"]["svg"])))
drawing = svg2rlg(BytesIO(b64decode(item["value"])))
scaling_x = item["width"] / 100 * float(box.getWidth()) / drawing.width
scaling_y = item["height"] / 100 * float(box.getHeight()) / drawing.height

Check warning on line 25 in sign_biometric_oca/models/sign_oca_request.py

View check run for this annotation

Codecov / codecov/patch

sign_biometric_oca/models/sign_oca_request.py#L22-L25

Added lines #L22 - L25 were not covered by tests

Expand Down
5 changes: 3 additions & 2 deletions sign_biometric_oca/static/src/components/biometric.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import {registry} from "@web/core/registry";

const signatureSignOca = {
uploadSignature: function (parent, item, signatureItem, data) {
item.value = data;
console.log(item);
item.value = data.svg;
// TODO: Transform this in something more standard....
parent.sensitiveData[item.id] = data.paths;
parent.postIframeField(item);
parent.checkFilledAll();
var next_items = _.filter(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,10 @@
</t>

<t t-name="sign_biometric_oca.sign_iframe_field_biometric_signature">
<!--
<svg class="o_sign_biometric_oca_display"
style="width:100%;height:100%" >
<t t-if="item.value.data">
<path t-att-d="data" t-foreach="item.value.data" t-as="data" t-key="data_index" />
</t>
</svg>-->

<embed
style="width:100%;height:100%"
t-attf-src="data:image/svg+xml;base64,{{item.value.svg}}"
t-if="item.value and item.value.svg"
t-attf-src="data:image/svg+xml;base64,{{item.value}}"
t-if="item.value"
/>
<div style="width:100%;height:100%" t-else="" t-out="placeholder" />
</t>
Expand Down

0 comments on commit d7cbc9c

Please sign in to comment.