top of page
Writer's pictureUniversal Web

COMO CREAR LOGIN Y SIGNUP EN WIX | TUTORIAL


Hey, cómo vamos? Ha pasado un tiempo desde el último vídeo, aquí les traigo este nuevo tutorial COMO CREAR LOGIN Y SIGNUP en WIX STUDIO. Podrás personalizar el diseño e información que necesitas de tus usuarios!

No olvides subscribirte y comentar alguna pregunta! Podes contactar a universal por aquí ve https://www.universalwebcode.com/



CODE - LOGIN LIGHTBOX

// Velo API Reference: https://www.wix.com/velo/reference/api-overview/introduction
import { authentication } from 'wix-members-frontend';
import wixWindowFrontend from 'wix-window-frontend';

$w.onReady(function () {

    $w("#btnLogin").onClick(() => {
		const email = $w("#email").value;
		const pwd = $w("#pwd").value;

        authentication.login(email, pwd)
            .then(() => {
                console.log('Member is logged in');
				wixWindowFrontend.lightbox.close();
				
            })
            .catch((error) => {
                console.error(error);
            });
    })

});

CODE SIGNUP - LIGHTBOX

// Velo API Reference: https://www.wix.com/velo/reference/api-overview/introduction
import { authentication } from 'wix-members-frontend';
import wixWindowFrontend from 'wix-window-frontend';

$w.onReady(function () {

    $w("#btnSignup").onClick(() => {
        const email = $w("#email").value;
        const pwd = $w("#pwd").value;

        authentication.register(email, pwd)
            .then((registrationResult) => {
                const status = registrationResult.status;

                if (status === "PENDING") {
                    // When the site is configured for manual approval,
                    // status is "PENDING" and approvalToken is returned.
                    const approvalToken = registrationResult.approvalToken;
                    console.log('Member registered and waiting for approval:', registrationResult);
                } else {
                    // When the site is configured for automatic approval,
                    // status is "ACTIVE" and the member is approved and logged in.
                    // To prevent logging in the member automatically,
                    // use the backend function: wix-members-backend.authentication.register()
                    console.log('Member registered and logged in:', registrationResult);
                    wixWindowFrontend.lightbox.close();
                }
            })
            .catch((error) => {
                console.error(error);
            });
    })

});
22 views0 comments

Comments


bottom of page