From 1fd9e4411fdf3c155132055045ba9ab0d9d5f706 Mon Sep 17 00:00:00 2001 From: ttpl-rt-134 Date: Tue, 22 Aug 2023 15:24:52 +0530 Subject: [PATCH] Aadhaar number should be masked after registration --- .../src/app/forms/forms.component.ts | 24 ++++++++++++------- .../app/forms/types/verify-aadhaar.type.html | 2 +- .../app/forms/types/verify-aadhaar.type.ts | 8 +++---- donor-registry/src/assets/config/home.html | 2 +- .../src/assets/config/ui-config/forms.json | 8 +++---- 5 files changed, 26 insertions(+), 18 deletions(-) diff --git a/donor-registry/src/app/forms/forms.component.ts b/donor-registry/src/app/forms/forms.component.ts index 5d332f9d..c4b8c9f9 100644 --- a/donor-registry/src/app/forms/forms.component.ts +++ b/donor-registry/src/app/forms/forms.component.ts @@ -168,7 +168,7 @@ export class FormsComponent implements OnInit { mobilePlaceholder['placeholder'] = "XXXXXXXXXX"; } - const aadhaarPlaceHolder = document.getElementById('aadhaar'); + const aadhaarPlaceHolder = document.getElementById('aadhaarMasked'); if (aadhaarPlaceHolder) { aadhaarPlaceHolder['placeholder'] = "XXXXXXXXXXXX"; } @@ -247,6 +247,10 @@ export class FormsComponent implements OnInit { // } // } localStorage.setItem('notReadOnly', JSON.stringify(Object.keys(obj))); + + if (this.model.hasOwnProperty('aadhaarMasked') && !this.model.hasOwnProperty('aadhaar')) { + this.model['aadhaar'] = this.model['aadhaarMasked']; + } } } } @@ -289,13 +293,14 @@ export class FormsComponent implements OnInit { } - if (document.getElementById("aadhaar")) { - (document.getElementById("aadhaar")).disabled = true; - + if (document.getElementById("aadhaarMasked")) { + (document.getElementById("aadhaarMasked")).disabled = true; } - + if (this.model.hasOwnProperty('aadhaar')) { + this.model['aadhaarMasked'] = 'XXXXXXXX' + this.model['aadhaar'].substring(8); + } const relationPlaceholder3 = (document.getElementById("formly_155_enum_relation_1")); if (relationPlaceholder3) { @@ -333,11 +338,14 @@ export class FormsComponent implements OnInit { } - if (document.getElementById("aadhaar")) { - (document.getElementById("aadhaar")).disabled = true; + if (document.getElementById("aadhaarMasked")) { + (document.getElementById("aadhaarMasked")).disabled = true; } + if (this.model.hasOwnProperty('aadhaar')) { + this.model['aadhaarMasked'] = 'XXXXXXXX' + this.model['aadhaar'].substring(8); + } let notReadOnly = localStorage.getItem('notReadOnly'); if (!notReadOnly || notReadOnly === "[]") { @@ -1936,7 +1944,7 @@ export class FormsComponent implements OnInit { let dateSpan = document.getElementById('mobileno'); dateSpan.classList.remove('ng-invalid'); - let aadhaardiv = document.getElementById('aadhaar'); + let aadhaardiv = document.getElementById('aadhaarMasked'); aadhaardiv.classList.remove('ng-invalid'); if (!this.form2.valid) { diff --git a/donor-registry/src/app/forms/types/verify-aadhaar.type.html b/donor-registry/src/app/forms/types/verify-aadhaar.type.html index ac32dab1..12750899 100644 --- a/donor-registry/src/app/forms/types/verify-aadhaar.type.html +++ b/donor-registry/src/app/forms/types/verify-aadhaar.type.html @@ -3,7 +3,7 @@
diff --git a/donor-registry/src/app/forms/types/verify-aadhaar.type.ts b/donor-registry/src/app/forms/types/verify-aadhaar.type.ts index 6f6e3524..105e6b15 100644 --- a/donor-registry/src/app/forms/types/verify-aadhaar.type.ts +++ b/donor-registry/src/app/forms/types/verify-aadhaar.type.ts @@ -259,8 +259,8 @@ export class VerifyAadhaar extends FieldType { let dateSpan = document.getElementById('mobmessage'); dateSpan.classList.remove('text-danger'); dateSpan.innerText = ""; - document.getElementById('aadhaar').classList.remove('is-invalid'); - (document.getElementById('aadhaar') as any).disabled = true; + document.getElementById('aadhaarMasked').classList.remove('is-invalid'); + (document.getElementById('aadhaarMasked') as any).disabled = true; this.dataObj = data; let dayOfBirth = data?.dayOfBirth; @@ -277,7 +277,7 @@ export class VerifyAadhaar extends FieldType { this.canRegister = false; this.openPopup('registerAge'); this.isVerify = false; - (document.getElementById('aadhaar') as any).disabled = false; + (document.getElementById('aadhaarMasked') as any).disabled = false; } else { const healthIdNumber = this.dataObj.healthIdNumber.replaceAll('-', ''); @@ -287,7 +287,7 @@ export class VerifyAadhaar extends FieldType { localStorage.setItem('isVerified', JSON.stringify(this.isVerify)); // document.getElementById('closeModalButton').click(); setTimeout(() => { - (document.getElementById('aadhaar') as any).focus(); + (document.getElementById('aadhaarMasked') as any).focus(); }, 1000); } } diff --git a/donor-registry/src/assets/config/home.html b/donor-registry/src/assets/config/home.html index 58e2c65a..da30d06f 100644 --- a/donor-registry/src/assets/config/home.html +++ b/donor-registry/src/assets/config/home.html @@ -5,7 +5,7 @@ national-orgran
diff --git a/donor-registry/src/assets/config/ui-config/forms.json b/donor-registry/src/assets/config/ui-config/forms.json index 01e93d88..9b1cc429 100644 --- a/donor-registry/src/assets/config/ui-config/forms.json +++ b/donor-registry/src/assets/config/ui-config/forms.json @@ -113,9 +113,9 @@ } }, { - "name": "aadhaar", + "name": "aadhaarMasked", "custom": true, - "key": "aadhaar", + "key": "aadhaarMasked", "type": "verify-aadhaar", "element": { "title": "Aadhaar Number", @@ -697,9 +697,9 @@ } }, { - "name": "aadhaar", + "name": "aadhaarMasked", "custom": true, - "key": "aadhaar", + "key": "aadhaarMasked", "type": "verify-aadhaar", "element": { "title": "Aadhaar Number",