Adding alerts to authentication

Hi,
So I ve just created new page with authentication (with firebase) and I am wondering how to add alerts to Login page so for example there won’t be errors like “Wrong email format”, or if the email won’t be corrent, the alerts would popout.

My code in ts:

async login(user: User){
    const result = this.aFAuth.auth.signInWithEmailAndPassword(user.email, user.password);
      this.navCtrl.setRoot(MainPage);
  }

Thanks for helping!

I recommend this guidance from Josh:

What about when somebody isnt in the firebase?

I mean, when someone tries to login with wrong email and password, app gets error and it still move forward the user to the next page. How to prevent it?

An if clause to prevent the navigation when there was an error?

Probably if u use the promise pattern with then and catch (instead of async?) u can handle properly

Yea, sounds good. But maybe can you gauide me how to do this? I am pretty bew to ionic, making my first app.

https://firebase.google.com/docs/auth/web/password-auth

Lots of examples

Use google too

Or continue async await and learn like me from

1 Like