0
Hello, I wonder if I can use validation without by setting the "Authentication" of FIREBASE, I have a list of objects,
if(placa == 'ABC123' && senha == '123')
alert('logado')
else if(placa != 'ABC123')
alert('placa errada')
else if (senha != '123')
alert('senha incorreta')
Before, I take all the records in DB, so I bring all the items I need
getTrucks() {
this.truckService.getTrucks()
.subscribe(
result => this.trucks = result
)
}
I have tried using for and filter, but the validation does not work using the for
filterTruck() {
return this.trucks.filter((item) => {
if(item.placa == this.truck.placa && item.password == this.truck.password) {
console.log(item)
this.navCtrl.setRoot('TabsPage');
this.auth.authentication(true);
this.auth.truckLogedd(user);
return true;
} else if(item.placa != this.truck.placa) {
console.log('Placa não confere')
return false;
} else if(item.senha != this.truck.senha) {
console.log('Senhanão confere')
return false;
}
return false;
})
}
now, using filter to try to validate
filterTruck(users) {
for(let user of users) {
if(user.password != this.truck.password || user.placa != this.truck.placa) {
this.showAlert('Ops!', 'Senha ou placa errada!')
break;
} else {
this.navCtrl.setRoot('TabsPage');
this.auth.authentication(true);
this.auth.truckLogedd(user);
break;
}
}
}
I am trying to do this validation without using firebase "Authentication", it is interesting to do so or using "Auhtentication" same ?
I’m sorry Hugo Costa, I didn’t express myself well, it’s authentication and not validation, and that’s just it, I want to do an authentication without needing Firebase’s own Authentication method, I don’t know if I could explain.... is not about validating fields....
– Rafael Moura