Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

236
Visualizações
Firebase - email is not defined

I am trying to build a function that allows user to change their password. The problem is when I am getting the current user's data it shows that the email is null.

Everything works on Firebase, users are creating in Firebase auth system.

Here is a part of my code

reauthenticate = (currentPassword) => {
    var user = firebase.auth().currentuser;
    var cred = firebase.auth.EmailAuthProvider.credential(user.email, currentPassword);
    user.reauthenticateWithCredential(cred);
}

reauthenticate(currentPassword).then(() => {
    var user = firebase.auth().currentuser;
    user.updatePassword(newPassword).then(() => {
        alert("Password changed");
        window.location.replace("./index.html");
    }).catch((error) => {
        console.log(error);
    })
});

What console shows is Uncaught TypeError: Cannot read properties of undefined (reading 'email') at reauthenticate (password.js:15:64) at changePassword (password.js:27:9)

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

its currentUser not currentuser. Capital U.

const user = firebase.auth().currentUser;
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda