+ placeholder="Enter the old PIN"
+ />
+
Old PIN is required and must be 4 digits.
-
-
New PIN:
+
-
+ placeholder="Enter the new PIN"
+ />
+
New PIN is required and must be 4 digits.
-
-
Password:
+
-
+ placeholder="Enter your password"
+ />
+
Password is required.
-
+
@@ -82,7 +177,6 @@
Change PIN
-
\ No newline at end of file
+
diff --git a/src/app/components/account-pin/account-pin.component.ts b/src/app/components/account-pin/account-pin.component.ts
index 77cd000..c1acc79 100644
--- a/src/app/components/account-pin/account-pin.component.ts
+++ b/src/app/components/account-pin/account-pin.component.ts
@@ -3,8 +3,9 @@ import { ApiService } from 'src/app/services/api.service';
import { LoadermodelService } from 'src/app/services/loadermodel.service';
import { Component, OnInit } from '@angular/core';
-import { FormBuilder, FormGroup, Validators } from '@angular/forms';
+import { FormControl, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
+import { passwordMismatch } from 'src/app/util/formutil';
@Component({
selector: 'app-account-pin',
@@ -20,7 +21,6 @@ export class AccountPinComponent implements OnInit {
constructor(
private apiService: ApiService,
- private fb: FormBuilder,
private _toastService: ToastService,
private router: Router,
private loader: LoadermodelService // Inject the LoaderService here
@@ -46,37 +46,34 @@ export class AccountPinComponent implements OnInit {
initPinChangeForm(): void {
if (this.showGeneratePINForm) {
// For "Generate PIN" form
- this.pinChangeForm = this.fb.group({
- newPin: [
- '',
- [
+ this.pinChangeForm = new FormGroup(
+ {
+ newPin: new FormControl('', [
Validators.required,
Validators.minLength(4),
Validators.maxLength(4),
- ],
- ],
- password: ['', Validators.required],
- });
+ ]),
+ confirmPin: new FormControl('', Validators.required),
+ password: new FormControl('', Validators.required),
+ },
+ {
+ validators: passwordMismatch('newPin', 'confirmPin'),
+ }
+ );
} else {
// For "Change PIN" form
- this.pinChangeForm = this.fb.group({
- oldPin: [
- '',
- [
- Validators.required,
- Validators.minLength(4),
- Validators.maxLength(4),
- ],
- ],
- newPin: [
- '',
- [
- Validators.required,
- Validators.minLength(4),
- Validators.maxLength(4),
- ],
- ],
- password: ['', Validators.required],
+ this.pinChangeForm = new FormGroup({
+ oldPin: new FormControl('', [
+ Validators.required,
+ Validators.minLength(4),
+ Validators.maxLength(4),
+ ]),
+ newPin: new FormControl('', [
+ Validators.required,
+ Validators.minLength(4),
+ Validators.maxLength(4),
+ ]),
+ password: new FormControl('', Validators.required),
});
}
}
diff --git a/src/app/components/register/register.component.html b/src/app/components/register/register.component.html
index faa5dbc..80a09ff 100644
--- a/src/app/components/register/register.component.html
+++ b/src/app/components/register/register.component.html
@@ -130,8 +130,6 @@