How to reset firebase password?

Asked

Viewed 12 times

0

Good afternoon, I am trying to create a function that allows the user to reset his password when informing his email. According to the firebase documentation the user only needs to provide the email that the firebase itself takes charge of sending a reset link.

I found this way to reset using React-Native

const forgotPassword = (email) => {
        firebase.auth().sendPasswordResetEmail(email)
          .then(function (user) {
            alert('Por favor verifique seu email...')
          }).catch(function (e) {
            console.log(e)
          })
      }

It turns out that this function needs an import, I tried to import firebase from firebase itself, as I also tried to import my connection file with firebase and auth from @React-Native-firebase/auth and none of them worked.

Please, if anyone knows how to reset the password using firebase help me!!!

1 answer

0

//redefinir Senha
    async function forgotPassword(){
        //redefinir Senha
        await firebase.auth().sendPasswordResetEmail(email)
            .then(() => {
                alert('Verifique sua caixa de e-mail.')
                navigation.navigate('tipoLogin')
            })
        .catch((error) => {
            var errorCode = error.code;
            var errorMessage = error.message;
            console.log(errorCode);
            console.log(errorMessage);
        });
    }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.