Correction pour soumettre le formulaire
avec la touche "Enter"
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
<form [formGroup]="loginForm" (ngSubmit)="onLoginSubmit()" autocomplete="off" style="padding: 10px;">
|
<form focusInvalidInput autocomplete="off" style="padding: 10px;"
|
||||||
|
[formGroup]="loginForm" (ngSubmit)="onLoginSubmit()">
|
||||||
<p>
|
<p>
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<mat-label>{{ 'LoginUser_Username' | translate }}</mat-label>
|
<mat-label>{{ 'LoginUser_Username' | translate }}</mat-label>
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export class LoginUserComponent implements OnInit, AfterViewInit {
|
|||||||
username: ['', [Validators.required, Validators.minLength(3)]],
|
username: ['', [Validators.required, Validators.minLength(3)]],
|
||||||
password: ['', [Validators.required]]
|
password: ['', [Validators.required]]
|
||||||
},
|
},
|
||||||
{ updateOn: 'blur' }
|
{ updateOn: 'submit' }
|
||||||
);
|
);
|
||||||
|
|
||||||
// get return url from route parameters or default to '/'
|
// get return url from route parameters or default to '/'
|
||||||
@@ -54,10 +54,7 @@ export class LoginUserComponent implements OnInit, AfterViewInit {
|
|||||||
onLoginSubmit() {
|
onLoginSubmit() {
|
||||||
this.submitted = true;
|
this.submitted = true;
|
||||||
|
|
||||||
if (this.loginForm.invalid) {
|
if (this.loginForm.valid) {
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
this.authenticationService.login(this.formCtrls.username.value, this.formCtrls.password.value)
|
this.authenticationService.login(this.formCtrls.username.value, this.formCtrls.password.value)
|
||||||
.pipe(first())
|
.pipe(first())
|
||||||
@@ -72,3 +69,4 @@ export class LoginUserComponent implements OnInit, AfterViewInit {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user