upgrade failed log in

This commit is contained in:
Simone Ventura 2024-01-24 12:51:44 +01:00
parent ddfca9c137
commit cad13df9d2
2 changed files with 21 additions and 6 deletions

View File

@ -1,17 +1,21 @@
<form class="userForm" #f="ngForm">
<button class="btn btn-danger rounded-pill px-10" *ngIf="control" type="button">Name e/o Lastname errati</button>
<div class="form-group">
<label for="firstname">First name</label>
<input class="form-control" [(ngModel)]="templog.name" name="firstname" id="firstname">
</div>
<input class="form-control" [(ngModel)]="templog.name" name="firstname" id="firstname">
</div>
<div class="form-group">
<label for="lastname">Last name</label>
<input class="form-control" [(ngModel)]="templog.lastname" name="lastname" id="lastname">
</div>
<div class="form-group form-footer">
<button class="btn btn-outline-secondary" (click)="makeLogIn()" >LOG IN</button>
<button class="btn btn-success" (click)="emptyIn()">CANCEL</button>
<button class="btn btn-outline-secondary" (click)="makeLogIn()">LOG IN</button>
<button class="btn btn-success" (click)="emptyIn()">CANCEL</button>
</div>
</form>

View File

@ -12,6 +12,7 @@ import { Router } from '@angular/router';
})
export class LoginComponent implements OnInit {
@Input() templog = new TempLog ;
control:boolean = false;
users: User[] = [];
@ -24,12 +25,22 @@ export class LoginComponent implements OnInit {
}
makeLogIn(){
let ciao = 0;
let index=0;
for (const user of this.users) {
if((user.name == this.templog.name) && (user.lastname == this.templog.lastname)){
this.router.navigateByUrl('/users/' + user.id )
ciao=1
index = this.users.indexOf(user);
}
}
if(ciao==1){
this.router.navigateByUrl('/users/' + this.users[index].id )
}
else{
this.control=true;
}
}
emptyIn(){