Firebase-ui to check email

I have successfully set up Firebase email / password authentication using firebase-ui.

 var uiConfig = {
        signInSuccessUrl: '<?php echo $url; ?>',
        signInOptions: [
            // Leave the lines as is for the providers you want to offer your users.
            firebase.auth.GoogleAuthProvider.PROVIDER_ID,
            firebase.auth.FacebookAuthProvider.PROVIDER_ID,
            firebase.auth.EmailAuthProvider.PROVIDER_ID
        ],
        // Terms of service url.
        tosUrl: '<your-tos-url>'
    };

    // Initialize the FirebaseUI Widget using Firebase.
    var ui = new firebaseui.auth.AuthUI(firebase.auth());
    // The start method will wait until the DOM is loaded.
    ui.start('#firebaseui-auth-container', uiConfig);

      

but for security reasons I want the user to confirm his / her email address. But from the above code, it doesn't send a validation message to the user. Thus, I used the following method to send a verification mail to the user if he / she has not verified his / her account.

firebase.auth().onAuthStateChanged(function(user) {
    if (user && user.uid != currentUid) {
        if (firebase.auth().currentUser.emailVerified) {
            currentUid = user.uid;

        else {
        //---- HERE YOU SEND THE EMAIL
            firebase.auth().currentUser.sendEmailVerification();
            }

      

But when I used this code it sends multiple verification emails for one account. This means that this method is run every time the user reloads the page. It would be very helpful if someone could help me determine if a mailing list was sent or not to a specific user using firebase.

+3
javascript web firebase firebase-authentication firebaseui


source to share


No one has answered this question yet

Check out similar questions:

3998
How to validate an email address in JavaScript
46
Fire Base Confirmation Email Not Sent
nine
How to send confirmation email from Firebase?
8
checking email for firebase auth ui
6
Checking email with Firebase 3.0 on Android
4
Firebase - Auth - find users who signed up but didn't verify their email address
1
Firebase WEB - Email check not sent. What's wrong with the code
1
Firebase Auth (android) email validation requires some guidance
0
Firebase prevents account creation before checking email
0
Firebase Control Panel Email Checker



All Articles
Loading...
X
Show
Funny
Dev
Pics