I created a web registration, in Firebase. I can register, but if I soon with a valid email and password, I am not redirected into the system. And if I put an email and any password, it does not show the phrase "Invalid user or password" that I programmed to be displayed
HTML:
<div class="container-fluid">
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<form class="form-signin formularioLogin">
<h3 align="center">Domanda</h3>
<label>E-mail do Estabelecimento</label>
<div>
<input class="form-control" type="email" name="email" ng-model="admin.email"
placeholder="[email protected]">
</div>
<label>Senha</label>
<div>
<input class="form-control adminSenha" type="password" ng-model="admin.senha">
</div>
<button class="btn btn-block btn-success btnLogar" ng-click="logar(admin)">Entrar</button>
<div>{{ loginErro }}</div>
<button class="btn btn-block btn-primary btnLogar" ng-click="cadastrar(admin)">Cadastrar</button>
</form>
</div>
<div class="col-md-4"></div>
</div>
Controller:
$scope.logar = function(admin){
var email = admin.email;
var password = admin.senha;
firebase.auth().signInWithEmailAndPassword(email, password)
.then( function ( result ) {
//Usuário autenticado com sucesso
//Seu código para redirecionar vem aqui.
console.log(result);
$location.path('/inicial');
}, function ( error ) {
//Ops, ocorreu um erro, pode deixar seu código tratando o erro aqui
console.log('erro: '+error);
$location.path('/');
})
}