Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

237
Vistas
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 Respuestas
Responde la pregunta

0

its currentUser not currentuser. Capital U.

const user = firebase.auth().currentUser;
about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda