Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //add create user event
- btnSignUp.addEventListener('click', e=> {
- //get email and Password
- const email = txtEmail.value;
- const pass = txtPassword.value;
- const auth = firebase.auth();
- const promise = auth.createUserWithEmailAndPassword(email, pass);
- var user = firebase.auth().currentUser;
- user.sendEmailVerification();
- promise.catch(e => console.log(e.message));
- });
- //Add a realtime listener
- firebase.auth().onAuthStateChanged(function(user) {
- if (user.emailVerified) {
- console.log('Email is verified');
- console.log(user);
- } else {
- window.location = "index.html";
- firebase.auth().signOut();
- alert("Email is not verified");
- }
Add Comment
Please, Sign In to add comment