- Password length must be greater than or equal to 8
+
+ Password is required
+
+
+ Password length must be greater than or equal to 8 and password must contain one or more uppercase , lowercase , numeric and special characters
-
- Password is required
-
+
diff --git a/src/app/pages/customer/customer-form/customer-form.component.scss b/src/app/pages/customer/customer-form/customer-form.component.scss
index a312e65..d7e0251 100644
--- a/src/app/pages/customer/customer-form/customer-form.component.scss
+++ b/src/app/pages/customer/customer-form/customer-form.component.scss
@@ -16,4 +16,17 @@
.show-grid{
margin-bottom: 2rem;
}
+ .error-message-container {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ }
+
+ .error-message {
+ color: #7c0e0e;
+ }
+
+ .error-message.small {
+ font-size: 12px;
+ }
\ No newline at end of file
diff --git a/src/app/pages/customer/customer-form/customer-form.component.ts b/src/app/pages/customer/customer-form/customer-form.component.ts
index 8aadc1c..34bde18 100644
--- a/src/app/pages/customer/customer-form/customer-form.component.ts
+++ b/src/app/pages/customer/customer-form/customer-form.component.ts
@@ -12,6 +12,7 @@ export class CustomerFormComponent implements OnInit {
data:any =[];
userForm: FormGroup | any; formData:any =[]
heading:any =[];
+ action: any;
constructor(private dialogRef: NbDialogRef
,public _api:PageapiService,private dialogService: NbDialogService) {
@@ -20,6 +21,8 @@ export class CustomerFormComponent implements OnInit {
ngOnInit() {
console.log('dialogRef', this.dialogRef.componentRef.instance);
let details:any = this.dialogRef.componentRef.instance
+ console.log('details',details)
+ this.action = details.action
this.heading = details.title
@@ -64,6 +67,21 @@ export class CustomerFormComponent implements OnInit {
this.userForm.controls['password'].updateValueAndValidity();
}
this.userForm.patchValue(this.data)
+
+ // Add value change listener for password field
+ this.userForm.get('password').valueChanges.subscribe(value => {
+ const passwordControl = this.userForm.get('password');
+ if (value) {
+ passwordControl.setValidators([
+ Validators.required,
+ Validators.pattern('^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*_=+-]).{8,16}$')
+ ]);
+ } else {
+ passwordControl.clearValidators();
+ }
+ passwordControl.updateValueAndValidity({ onlySelf: true, emitEvent: false });
+ });
+
}
cancel(){
@@ -108,7 +126,10 @@ export class CustomerFormComponent implements OnInit {
this.formData.append('userName',tmp.userName)
this.formData.append('email', tmp.email);
- if((tmp.password != "")){
+ // if((tmp.password != "")){
+ // this.formData.append('password', tmp.password);
+ // }
+ if (tmp.password) {
this.formData.append('password', tmp.password);
}
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index 4e9236e..717f00a 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -10,6 +10,7 @@
export const environment = {
apiEndpoint:'https://api.vnms.in/api/',
+ // apiEndpoint:'https://dev.venbait.in/vnms/api/',
// apiEndpoint:'http://localhost:8081/api/',
mailUrl:'',
production: false,