Log in

Don't have an account?Sign Up

Start planning your

Journey

Reaching the top

John Doe

function signUp() { const email = document.getElementById('signUpEmail').value; const password = document.getElementById('signUpPassword').value; firebase.auth().createUserWithEmailAndPassword(email, password) .then((userCredential) => { // Sign-up successful. const user = userCredential.user; console.log('User signed up:', user.uid); alert('Sign-up successful!'); // Redirect or update the UI. }) .catch((error) => { console.error('Sign-up error:', error); alert('Sign-up error: ' + error.message); }); } function signIn() { const email = document.getElementById('signInEmail').value; const password = document.getElementById('signInPassword').value; firebase.auth().signInWithEmailAndPassword(email, password) .then((userCredential) => { // Sign-in successful. const user = userCredential.user; console.log('User signed in:', user.uid); alert('Sign-in successful!'); // Redirect or update the UI. }) .catch((error) => { console.error('Sign-in error:', error); alert('Sign-in error: ' + error.message); }); } firebase.auth().onAuthStateChanged((user) => { if (user) { console.log('User is signed in:', user.uid); // Update the UI for authenticated user. } else { console.log('No user is signed in.'); // Redirect to sign-in page or show sign-in form. } });