Help! login and signup just stopped working

Can anyone please help me out here.

My website was working absolutely fine up until a few days ago.

Now people can not login , click forgot password or submit registration request.

Here is my code for the lightbox, I have checked all of the object names to ensure they match.

It appears that wherever Wix-Users is involved it just has stopped working.

Is anyone else having this issue? as im at the end of my tether with this. i could revert to the Wix standard login however i dont feel it is fit for a customer facing website.

I contacted Wix support who claim i need to include the members data set in my page and link each individual item to the data set, however i believe this to be incorrect as there is no forgot password in the data set, nor is there a password field to link.

Also if you do try to link an email - you cannot type into the box

I have tried reverting to my last release over over 3 weeks ago, still didnt work. I have copied my exisitng light boxes as this seemed to fix a bug that was present last month, this also didnt work

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

$w.onReady(function (){
    $w("#forgottenPassword").onClick(
        (event) => {
 //WixWindow.lightbox.close//wixWindow.lightbox.close()

            wixUsers.promptForgotPassword()
            .then( ( ) =>{
 //
            })
            .catch((err) => {
 let errorMsg = err; //"The user closed the forgot password dialog"
            });
        });
    });
 
$w.onReady(function(){  
    $w('#loginNow').onClick(function (){    
 let email = $w('#loginEmail').value;    
 let password = $w('#loginPassword').value;  
        wixUsers.login(email,password)  
        .then(()=>{
            wixLocation.to('/HOME');   
            })
            .catch((err) => {
            console.log(err);

        $w("#passwordWrong").expand();
            });
        })
    })


Here is the code for my registration

import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
 
$w.onReady(function(){  
    $w('#registerNow').onClick(function (){  
let email = $w('#email').value;
let companyName = $w('#companyName').value;  // the user's company name
let password = $w('#password').value;  // the user's password
let firstName = $w('#firstName').value;  // the user's first name
let lastName = $w('#lastName').value; // the user's last name

wixUsers.register(email, password, {
    contactInfo: {
 "firstName": firstName,
 "lastName": lastName,
 "companyName": companyName,
    }
  })
  .then( (result) => {
 let status = result.status;
 let approvalToken = result.approvalToken; // "Pending"
 let user = result.user;
      wixLocation.to('/exit'); 
            })
        })
    })

First: Please put your code in the CODE-BLOCK (its left to the GIF )

Second: Is there any “Error-Message” on your console?

I’ve popped that in code block.

For the console would I view this in preview? Or live?

The live site is
https://www.smartmachineshelp.co.uk/

There are errors in your code.

In your login lightbox code you don’t need the second onReady page function and the onClick event handler needs to be changed.

$w.onReady(function(){
You don’t need this twice as already at the top of your page.

$w(‘#loginNow’).onClick(function (){
For the above you have combined the event handler in the code with the event handler through the properties panel option.

When using the event handler through the properties panel the code always gives you an export function
export function loginNow_onClick(event) {

However, if you write that event handler through your code, then you write it like this below, like you have done in other parts.
$w(“#loginNow”).onClick( (event) => {

You can’t use the second option in your code when you have added the onClick event handler through the properties panel too, otherwise you could end up having a double click for your button.

So, basically in your login lightbox code, your first onClick event handler for the forgot password option should be written through code like this here.
$w(“#forgottenPassword”).onClick( (event) => {

With the second event handler for the login now button being written with the event handler being added through the properties panel itself, like this below and not forgetting to delete that second onReady too.
export function loginNow_onClick(event) {

With your register lightbox code too after the onReady function, you have done exactly the same thing.

$w.onReady(function(){  
$w('#registerNow').onClick(function (){ 

Change it to this and delete the event handler for the button in the properties panel so that it does it all through the code.

$w.onReady(function(){  
$w("#registerNow").onClick( (event) => {

Finally, on your first code block for your login lightbox, make sure that this is just the two lines and not the three as you currently have it shown.

$w.onReady(function (){
$w("#forgottenPassword").onClick( (event) => {

This is login lightbox code on a site of mine, basically yours is the same.

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

$w.onReady(function () {
 $w("#forgotPassword").onClick( (event) => {
    //wixWindow.lightbox.close()
   wixUsers.promptForgotPassword()
   .then( ( ) => {
   //
   } )
    .catch( (err) => {
 let errorMsg = err;  //"The user closed the forgot password dialog"
    });
 });
});

export function loginButton_click(event) {

 let email = $w("#email").value;
 let password = $w("#password").value;

 wixUsers.login(email, password)
   .then( () => {
     console.log("User is logged in");
     wixLocation.to("/account/my-account");  //Change the URL ending to whatever page you want to send the user to after they log in.
   } )
    .catch( (err) => {
     console.log(err);
     $w("#errorMessage").expand();  // You can delete this line if you are not going to add an error message.  Use a regular text element set to 'collapse on load' from the Properties Panel.
   } ); 
}

Signup lightbox code too, however you have used the approval token method on yours, so the ending will be different obviously.

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.
      } );     
    } );
    
});

By the way, I am not having any issues with Wix being down anywhere for me. I can log in and out of any site and have had no complaints from anybody using any site of mine.

Not saying that it isn’t down for others, it might just be a certain area or server region that is affected for example, however I’m not having any issues myself.

Could even be Wix doing routine maintenance somewhere and it might be all up and running again soon, fingers crossed.

Thanks for your response,
I amended as per you instructions and still couldn’t log in :<

@givemeawhisky thanks for your response too
I tried to copy your login code and just change the objects to suit my own

And still have no luck.
Its almost as if the buttons on the damn lightbox do not exist

I dont need to do any linking in the actual editor itself do i?
Other then changing the property name of the objects in use?

Wix phone support seem to think this is due to me not having a dataset linked.

But im pretty sure importing WixUsers does that for me ?

i might be wrong i probably am, this is just getting frustrating lol

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

$w.onReady(function () {
 $w("#forgottenPassword").onClick( (event) => {
 //wixWindow.lightbox.close()
   wixUsers.promptForgotPassword()
   .then( ( ) => {
 //
   } )
    .catch( (err) => {
 let errorMsg = err;  //"The user closed the forgot password dialog"
    });
 });
});

export function loginButton_click(event) {

 let email =$w("#loginEmail").value;
 let password = $w("#loginPassword").value;

 wixUsers.login(email, password)
   .then( () => {
     console.log("User is logged in");
     wixLocation.to("/account/my-account");  //Change the URL ending to whatever page you want to send the user to after they log in.
   } )
    .catch( (err) => {
     console.log(err);
     $w("#passwordWrong").expand();  // You can delete this line if you are not going to add an error message.  Use a regular text element set to 'collapse on load' from the Properties Panel.
   } ); 
}

@martynbell

No you don’t need a dataset on your page for custom login lightbox.

Plus, with the login lightbox, you don’t need any elements linked through the Editor itself as it is all done through the code.

$w(“#forgottenPassword”).onClick( (event) => { is for the basic text element with forgot password in it, with the id simply changed to forgottenPassword.

Plus, no event handler is needed through the properties panel for this one as it is all written in the code.

export function loginButton_click(event) { is for the basic login button with the id simply changed to loginButton.

You do need to have the event handler added through the properties panel for the button on this.

The same with the signup lightbox, you don’t need a dataset on the page for that either.

It is the same as the login example, $w(“#registerButton”).onClick( (event) => { is for the register button with the id simply changed to registerButton and no event handler needed as already written into the code itself.

So once the register button is pressed the code will run and the register function will take all the user inputs and store them in Wix Users as they are now Site Members.

If you have anybody that contacts you through your site and is not a site member, they will always be in Wix CRM and not Wix Users.

The CRM API contains functionality for working with your site’s contacts.
The Users API contains functionality for working with users who are logged-in members.
Note that all members are also contacts, but contacts are not necessarily members.

If you are doing your own members profile like this tutorial here, then you will need to have a separate dataset on your page.
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area

However, as I’ve said previously, I’ve not had any issues logging into my own site and any other site and I’ve had nobody come back to me saying that they can’t gain access.

So, the problem might be server area specific or it might just be maintenance that is going on,
so you might be in an affected area which is covered by a affected server for example.

Unfortunately, if yours is still not working, then you will just have to wait and see what Wix do to sort it out, hopefully something very, very soon.

Although if it is still ongoing for you, then I would recommend that you phone up Wix directly and speak to them personally one on one so that they can check for you whilst you are on the phone to them.
https://support.wix.com/en/article/contacting-wix-by-phone-3491545

Sent everything over to Wix again today and their response is

"Thank you for contacting Wix Customer Solutions.
We are more than happy to assist you but regretfully we don’t support the wix corvid only on the forum that over there are the developers, but we as wix directly we don’t supported. Wish that I could be more helpful.

Feel free to contact us again if you need any further assistance. Have a good day."

It sounds like they are not going to actually look into this and are just blaming the code which is ridiculous

To add to the situation, i Just tested my signup lightbox in the editors preview … it works no problem, clearly an issue with the live site

Allas… today Wix finally managed to recreate this issue and is not looking into it.
As we suspected the issue is not with the code but with the wix servers.
I’ll be sure to update when they give me one

Quick update.
This has now been fixed, the issue was caused by “certain technical difficulties on our side”, very vague but atleast it is now up and running.

I reverted my site back to it’s original code in my OP and every thing is working great.

Looks like the issue was impacting some sites calling wix-users on lightboxes.

Thanks for the help getting to the bottom of this

BR Martyn