Does anybody else have this issue where you have a custom member log in page, but when you log in as a user, it takes you right back to the log in page and not the page underneath it with the member content?
And, once you sign up, it takes the user to the home page instead of the member content page. I’m not sure why it’s redirecting to the wrong place. Does anyone have a solution? WIX has been trying to figure it out, but so far there is no solution… I had to take the member page off-line until this problem is solved. the website is: www.takethestage.tv
I really appreciate any advice!
Here are two videos to see what I mean:
What is your code for the custom lightboxes as once the users login or signup they should simply be taken to whatever page you have set your Wix Location to be.
https://www.wix.com/corvid/reference/wix-location.html#to
wixLocation.to("/sign-in-status");
//Change the URL ending to whatever page you want to send the user to after they log in.
wixLocation.to(wixLocation.url);
//This reloads the same page that the lightbox popped up on, which in turn runs the page code again, so you can use if you want members parts to be shown from hidden state etc.
Hello givemeawhisky ,
Thank you for your response! This makes sense to me technically simple enough, though I am not a developer and don’t really know my way around code . Would you be able to do a Google chat with me where I could screenshare with you so you could show me where to input this URL? That would help me a ton! I’d buy you a whiskey as a thank you if you’re in NYC. You can e-mail me at zellgordon@gmail.com.
Thanks so much,
Dan
When you say custom login and signup, have you actually done custom lightboxes for both or have you used the custom form from Wix Forms that Wix provide you with instead of using their own default one.
https://support.wix.com/en/article/creating-a-custom-signup-form-for-your-members-area
If you are using the Wix own window for signup and login or the Wix Forms one that you can customise from the linked tutorial above, which I think that you have used to do your own, then you cant customise them that much and not with any code as they are already automated by themselves.
Therefore you will actually need to create your own custom lightboxes for login and signup where you can actually control where the user goes to after they have signed up or logged themselves in by using the Wix Location to as shown in the previous post above.
Also, if you have used custom lightboxes then you need to change your member signup settings as like this tutorial here. https://support.wix.com/en/article/corvid-enabling-custom-site-registration
Code for signup lightbox:
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.
} );
} );
});
Code for login lightbox:
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) {
//Make sure that you had added the onClick event in the properties panel.
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.
} );
}
Hi givemeawhisky ,
I included the coding as you suggested, but ran into an issue in line 5 that says “wix-window” How do I fix that? Is there anything I should edit?
Also, how do you include the check boxes that the user has to check in order to sign up (ie. terms of service, privacy policy etc) . The boxes that I put in, I don’t think are correct, as I just edited the boxes where the user puts something like pizza toppings in each check box. How do I make check boxes as a requirement for signing in with code?
Thanks for your help,
Dan
I’m on a deadline to have this complete this week along with an API integration and I’m waiting for WIX developers to fix the custom log in, so that is the absolute best option when they fix that so that there’s no longer a re-direct upon signing in. Meanwhile, I’m teaching myself code as a last resort.
You don’t need the lines 1 - 4, simply delete them. The imports should be the top and the start of the code.
For the making the checkboxes required, the simple option is to make sure that the required box is ticked in the properties panel for each of the checkboxes that you have on your page.
If you want either of the signup or login lightboxes to stay on the same page that they popped up on then simply use the Wix Location code from earlier with the url set as wixLocation.url and not any other page url.
Also, you have probably already seen that when you put blocks of text as code in this forum, that it sometimes duplicates parts of the code. Unfortunately there is nothing I can do about that to fix it myself.
If you want to go down the code route with those checkboxes, then have a look at this previous post and the Wix API reference for Checkboxes too.
https://www.wix.com/corvid/reference/$w.Checkbox.html
https://www.wix.com/corvid/forum/community-discussion/multiple-inputs-enable-and-disable-a-button
Now obviously it would have to be added into the code for the lightbox that you are using it on.