Hello, I would like to know if I can use validation without without the configuration of 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 get all the records in the DB, so I bring all the items I need
getTrucks() {
this.truckService.getTrucks()
.subscribe(
result => this.trucks = result
)
}
I've already tried using for and filter, but validation does not work using the
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 the 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'm trying to do this validation without having to use the "Authentication" of the firebase, is it interesting to do so or using the same "Auhtentication"?