Skip to content

Commit

Permalink
Merge pull request #401 from Sunbird-RC/esignIssue
Browse files Browse the repository at this point in the history
#198 - Aadhaar number should be masked after registration
  • Loading branch information
Pratikshakhandagale authored Aug 22, 2023
2 parents 0efd1dd + 1fd9e44 commit f7befae
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 18 deletions.
24 changes: 16 additions & 8 deletions donor-registry/src/app/forms/forms.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down Expand Up @@ -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'];
}
}
}
}
Expand Down Expand Up @@ -289,13 +293,14 @@ export class FormsComponent implements OnInit {

}

if (document.getElementById("aadhaar")) {
(<HTMLInputElement>document.getElementById("aadhaar")).disabled = true;

if (document.getElementById("aadhaarMasked")) {
(<HTMLInputElement>document.getElementById("aadhaarMasked")).disabled = true;
}



if (this.model.hasOwnProperty('aadhaar')) {
this.model['aadhaarMasked'] = 'XXXXXXXX' + this.model['aadhaar'].substring(8);
}

const relationPlaceholder3 = (<HTMLInputElement>document.getElementById("formly_155_enum_relation_1"));
if (relationPlaceholder3) {
Expand Down Expand Up @@ -333,11 +338,14 @@ export class FormsComponent implements OnInit {

}

if (document.getElementById("aadhaar")) {
(<HTMLInputElement>document.getElementById("aadhaar")).disabled = true;
if (document.getElementById("aadhaarMasked")) {
(<HTMLInputElement>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 === "[]") {
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="d-flex">
<input class="form-control" placeholder="XXXXXXXXXXXX" maxlength="12"
oninput="if (/[^0-9]/g.test(this.value)) this.value = this.value.replace(/[^0-9]/g,'')" id="{{ field.key }}"
[formControl]="formControl" [formlyAttributes]="field" pattern="[0-9]{12}"
[formControl]="formControl" [formlyAttributes]="field" pattern="[0-9X]{12}"
[ngClass]="isNumberValid ? 'form-control' : 'form-control is-invalid'" required>
<button id="verifybtn" class="fw-bold p14 pointer btn-holder btn-verify border-0" (click)="verifyOtp(field.key)"
*ngIf="!isVerify" [disabled]="!consentGiven"> {{'VERIFY' | translate}}</button>
Expand Down
8 changes: 4 additions & 4 deletions donor-registry/src/app/forms/types/verify-aadhaar.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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('-', '');
Expand All @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion donor-registry/src/assets/config/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<img class="img-fluid" height="75px" width="492px" src="./../../assets/images/NOTTO_WITH_TXT_LOGO.svg" alt="national-orgran">
</div>
<div class="d-flex">
<a href="/login" class="btn-holder akr">Coordinator’s Login</a>
<a class="btn-holder akr" >Coordinator’s Login</a>
<a href="/login" class="btn-holder akr ms-3">Pledger’s Login</a>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions donor-registry/src/assets/config/ui-config/forms.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@
}
},
{
"name": "aadhaar",
"name": "aadhaarMasked",
"custom": true,
"key": "aadhaar",
"key": "aadhaarMasked",
"type": "verify-aadhaar",
"element": {
"title": "Aadhaar Number",
Expand Down Expand Up @@ -697,9 +697,9 @@
}
},
{
"name": "aadhaar",
"name": "aadhaarMasked",
"custom": true,
"key": "aadhaar",
"key": "aadhaarMasked",
"type": "verify-aadhaar",
"element": {
"title": "Aadhaar Number",
Expand Down

0 comments on commit f7befae

Please sign in to comment.