Can someone confirm the sequence of events that get fired when a user logs into Wix using WixUsers.login(email, password).
I’m finding that if a user tried to load a Members only page, while logged out, they are directed to the LogIn lightbox, where the .login command is executed, but then control flows straight to completing the Members Page load, rather executing the login promise, or indeed, raising the onLogIn event. Is this a bug or expected behaviour?
Does the site in question have a custom sign up form? If yes, the events of the login process depend on your code specification in or after the onLogin event. As such we’ll have to take a look at your code to understand the issue
Sam,
I do have a custom sign up form in the form of the LightBox example provided. After further investigation, I can confirm that the onLogin event is firing and being picked up by the Site OnLogin event handler. However, I am noticing, with the same code, different behaviour depending on whether the login statement (in the LightBox page code) is being executed as a result of a user pressing a button on the Home page, or the user selecting to load a Members Only page from the menu bar on the home page.
If I use the sequence: Home Page Button - LightBox - Home page I get a console trace of:
onready onLogin88f9e943-xxxxxxx-ccdf26676a2b
console.js:35 findMemberProfile88f9e943-xxxxxxx-ccdf26676a2b
bolt-worker.js:18 lbxLogIn1 : User is logged in
console.js:35 Log In lightbox success
console.js:35 Results =
console.js:35 {email: “allent@gmail.com”, …}
console.js:35 {email: “allent@gmail.com”, …}
console.js:35 {email: “allent@gmail.com”, …}
console.js:35 onready onLogin endTrevor Allen
If I use the sequence Home Page Menu: Members Page - LightBox - Members Page I get a console trace of:
onready onLogin88f9e943-xxxxxxx-ccdf26676a2b
bolt-worker.js:18 findMemberProfile88f9e943-xxxxxxx-ccdf26676a2b
bolt-worker.js:18 lbxLogIn1 : User is logged in
console.js:35 Loading the code for the site. To debug this code, open masterPage.js in Developer Tools.
console.js:35 Loading the code for the Home page. To debug this code, open mainPage.js in Developer Tools.
console.js:35 Site on ready 1575188808496
console.js:35 site on ready Is logged in
console.js:35 Page on ready 1575188808501true
ie in the first sequence, the flow allows the findMemberProfile database read to complete, the LightBox code after the login statement to complete and all is well.
In the second example, it looks like the database read and the LightBox code gets lost as Site and Page scripts are loaded.
I dont particularly want to have to put a specific LogIn button on a page at this stage in the site’s life, but if that is the only way to control the flow properly, then so be it.
Am I missing something?
File below contains summary of relevant code: