authentication.register help

I am using authentication.register to register members to my site.

I run the following function as part of the process:

async function submitReg() {        
    var email = $w("#email").value;
    var password = $w("#password").value;
    var first = $w("#firstName").value;
    var last = $w("#lastName").value;
    
    authentication.register(email, password, {
        contactInfo: {
        'firstName': first,
        'lastName': last
        },
        privacyStatus: "PUBLIC"
    })
    .then((registrationResult) => {
        const status = registrationResult.status;
        console.log("registrationResult");
        console.log(status);
        wixWindow.openLightbox("Successful Reg");
    })
    .catch((err2) => {
        if (err2.includes("already exists in collection")) {
            $w('#errorMessage').text = "This email address has already been used";
            $w('#errorMessage').expand();
            $w('#resetPassword').expand();
        } else {
            wixWindow.openLightbox("Failed Reg");
        }
        
    })
}

As you can see, I don’t return from this function…as, if it is successful, then registration is done. However the Successful Reg lightbox never opens…because Wix generates a full-screen lightbox with a message saying the registration is pending admin review. Is there a way to stop Wix from opening that full screen lightbox, so I can control the user experience?

Simon.

It sounds like you have manual approval for your registration process perhaps?

If that is the case, you will want to look at approvebytoken() or approvebyemail() to finish the process automatically.

Do note that some other users have reported a bug recently with approveByToken(). If you experience this as well, please report to customer care so that it can be added to any tickets if the issue is still happening

details from register docs
“If Site Members is configured for automatic approval , the register() function returns a status of “Active” and the user becomes an active member of the site.
If Site Members is configured for manual approval , the register() function returns a status of “Pending” and the user becomes a pending member of the site. In order to activate a pending user, the site owner can approve the user manually , using the Contacts application or you can call the approveByToken() or approveByEmail() functions.”

OK…I see what you’re proposing. I will give this a try. Looks like it will give me control of the user experience by taking care of the registration in the back-end.

I’m having issue with this API - authentication . register

The member is created but it does not return any response. Is there an issue with this API which we are not aware?

BTW - the old API wixUsersBackend . register works great.

Did you resolve your issue?

Hello. There is a known issue right now, please report to customer care so they can update you on the status and maintain an understanding of the scope of the issue. Customer care is not present in this forum.