upgrade failed log in
This commit is contained in:
parent
ddfca9c137
commit
cad13df9d2
@ -1,17 +1,21 @@
|
|||||||
<form class="userForm" #f="ngForm">
|
<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">
|
<div class="form-group">
|
||||||
<label for="firstname">First name</label>
|
<label for="firstname">First name</label>
|
||||||
<input class="form-control" [(ngModel)]="templog.name" name="firstname" id="firstname">
|
<input class="form-control" [(ngModel)]="templog.name" name="firstname" id="firstname">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="lastname">Last name</label>
|
<label for="lastname">Last name</label>
|
||||||
<input class="form-control" [(ngModel)]="templog.lastname" name="lastname" id="lastname">
|
<input class="form-control" [(ngModel)]="templog.lastname" name="lastname" id="lastname">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group form-footer">
|
<div class="form-group form-footer">
|
||||||
<button class="btn btn-outline-secondary" (click)="makeLogIn()" >LOG IN</button>
|
<button class="btn btn-outline-secondary" (click)="makeLogIn()">LOG IN</button>
|
||||||
<button class="btn btn-success" (click)="emptyIn()">CANCEL</button>
|
<button class="btn btn-success" (click)="emptyIn()">CANCEL</button>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
@ -12,6 +12,7 @@ import { Router } from '@angular/router';
|
|||||||
})
|
})
|
||||||
export class LoginComponent implements OnInit {
|
export class LoginComponent implements OnInit {
|
||||||
@Input() templog = new TempLog ;
|
@Input() templog = new TempLog ;
|
||||||
|
control:boolean = false;
|
||||||
users: User[] = [];
|
users: User[] = [];
|
||||||
|
|
||||||
|
|
||||||
@ -24,12 +25,22 @@ export class LoginComponent implements OnInit {
|
|||||||
|
|
||||||
}
|
}
|
||||||
makeLogIn(){
|
makeLogIn(){
|
||||||
|
|
||||||
|
let ciao = 0;
|
||||||
|
let index=0;
|
||||||
for (const user of this.users) {
|
for (const user of this.users) {
|
||||||
|
|
||||||
if((user.name == this.templog.name) && (user.lastname == this.templog.lastname)){
|
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(){
|
emptyIn(){
|
||||||
|
Loading…
Reference in New Issue
Block a user