Registration Disconnected from Login

Hi all,

Problem: Somehow my custom registration page has disconnected from the membership signup.

I can register members into a dataset/collection, but they are not appearing as members (pending or auto-signed up). In my “member dataset” they have ID’s, I can see their login and passwords and other requested fields.

The site is at www.myunisquare.com. feel free to make up a username with domain “@my.westminster.ac.uk

Goal:

  1. Use custom registration (signup) form with MANUAL approval (for now)
  2. Use Wix Members Area

#Custom #Registration #WixCode #MembersArea #SNAFU

This works perfectly and closes after registering details before moving onto sign in status page, then both names will be saved in contacts and once site member is manually approved the member details will be added to my ‘members’ database.

import wixUsers from 'wix-users';
import wixWindow from 'wix-window';
import wixLocation from 'wix-location';

$w.onReady(function () {
    
    $w("#registerButton").onClick( (event) => {
        
   let email = $w("#email").value;
   let password = $w("#password").value;
   let first = $w("#firstName").value;
   let last = $w("#lastName").value;

   wixUsers.register(email, password, {
       contactInfo: {
        "firstName": $w('#firstName').value,
        "lastName": $w('#lastName').value,
       }
      } )
      .then( (result) => {
        let resultStatus = result.status;
  wixWindow.lightbox.close();
  wixLocation.to("/sign-in-status");  //Change the URL ending to whatever page you want to send the user to after they log in.
      } );     
    } );
    
});

If you want to go to approval by third party, token, email etc, then have a look at the ‘REGISTER’ sections in these Wix Code API sections:
https://www.wix.com/code/reference/wix-users.html
https://www.wix.com/code/reference/wix-users-backend.html

Hi @givemeawhisky I read your code, but I would use it with the default Wix promptLogin/Register via code, in order to have a control also on the registration, is it possible ?
thx in advance

wixUsers.promptLogin( {"mode": "login", "lang": "it"} )
      .then( (user) => {
        userId = user.id;
 return user.getEmail();
      } )

If you are wanting to use promptLogin instead, then read the API page about it here:
https://www.wix.com/corvid/reference/wix-users.html#promptLogin

If you scroll down the page, it will give you code examples and the one titled ‘Prompt the current user to login with given options’ gives you the options of changing the language.

I read it and I have the impression that if I want to use promptLogin, let’s consider that it also manages automatically the Registration, I have to renounce to manage the registration process as you indicate in the following code, do you confirm ?

   wixUsers.register(email, password, {
       contactInfo: {
        "firstName": $w('#firstName').value,
        "lastName": $w('#lastName').value,
       }
      } )