Redirect to custom login page instead of default wix Login

Hey guys,
Is it possible to redirect the user to a custom register/login page [created in wix code] Instead of default wix login popup?
Like i want this to take effect on wix blog , forum or when ever the user prompt to login it will redirect to the custom login page

Thanks for everything!

3 Likes

looking for this as well

This is already possible.


The signup and login process would then be handled with wixUsers.register() and wixUsers.login()

The Signup can also be linked to a Lightbox if you want it to be a popup window

Let me know when you implement this. I created custom log in pages for 2 different website by following the code here.
https://support.wix.com/en/article/how-to-build-your-own-members-area-using-code
Both websites experience the same issue:
When I log in the button doesn’t switch to logout and the profile button doesn’t show up. After a few times I realized when I refresh the page it shows the correct states of the buttons. Basically the login page doesn’t download correctly at first and has to be refreshed. Has anyone experienced this?

Someone solved this? I also had the same problem. Created custom login lightbox, linked it in setting but when I access the private pages directly, instead on the login button, the standard login page appears

I actually assume it was for a sign up page only.

Hi Salman,

Now that we have the login API, you can create your custom login page, and add a link from the signup custom page to the login page (eg., "already a member? click here to login ).
In addition, in the member signup settings panel, under the “which option shows first” section you need to select " New member signup ".

This way the default login page will never be triggered by an external application / restricted page / login bar, and only the custom signup page will be opened with a link to the custom login page.

Hope this helps.
Let me know if you have any questions.

Thanks

Hi Ella,

Could you kindly explain how to create your custom login page using the Login API? I am unfamiliar with the coding aspect.

I am trying (and failing) to create the a similar structure. A custom login page for members, and for non-members they can click a “Not a Member?” link to be redirected to a signup page.
Could you please advise, it would be greatly appreciated.

Thank you!

Hi Raja,

The login() function returns a Promise that resolves when the user with the specified email address and password is logged in.
Checkout the API documentation here - https://www.wix.com/code/reference/wix-users.html#login

You can create a custom login form in the editor, put it within a lingbox (same as you created for the custom signup). The login form is used to log a user in based on email and password, so you need add to your custom login form, an input field for login and one for password field, and add a link to connect between the login page and the signup page.

And here’s a link to an article for a basic example of working with the new registration APIs - Velo Tutorial: Creating a Custom Registration Form with Code | Help Center | Wix.com
https://www.wix.com/code/home/forum/wix-tips-and-updates/custom-member-registration

Hope this helps.

Thanks

how can i hide strip after user login in.i need code for the same

This is for just signups not log in

That is one problem with wix, the buttons wont show or update until you refresh the page. I filled for same complain long ago and nothing is done about it yet.

I don’t see where anyone actually answered the question about the login buttons REFRESHING… I have the very Same Problem. I used the new API and created a custom login that invokes a light box for logging the user in.

If the user is NOT LOGGED IN:

After LOG IN the header changes to:


I have a custom “My Dashboard” that includes other data from a Database that is not available in the default Wix User Profile. My site code Checks to see if the user is Logged in and if so, shows the
“My Dashboard Button”.

Obviously the site code is NOT run when the user logs in. If I click on ANY OTHER PAGE the header is Refreshed and the “My Dashboard” button appears.

I consider this a bug…

I have solved this problem now with auto sync

@sparkwix Yes I still have the problem…

@sparkwix I would also love to learn how you resolved this problem.

You just need your custom login lightbox to refresh the page when it closes.

This code below is for my login lightbox which allows the user to log themselves in and then it automatically closes the lightbox before refreshing the same page so that the code is kicked into gear so that the login button changes to logout and my hidden elements are shown.

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_onclick(event) {

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

 wixUsers.login(email, password)
   .then( () => {
     console.log("User is logged in");
     wixWindow.lightbox.close();
     wixLocation.to(wixLocation.url);  //This reloads the same page and allows code to show hidden member parts.
   } )
    .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.
   } ); 
}


For those who couldn’t solve this problem.
https://www.youtube.com/watch?v=QbH8_eudjbE
check this out.

After implementing the custom login/logout process by enabling Custom signup in the Members pages, everything seemed to be working. Then came the glitch that, on occasion, the default login light box ALSO is rendered! This is truly bizarre, and I’m certain is a Wix BUG. It seems to me that the wix store/members integration is flawed.

Have you setup your own custom lightboxes for login and signup and setup the member signup for your own custom lightbox as shown here.
https://support.wix.com/en/article/corvid-enabling-custom-site-registration

Plus, have you got any code on your page that is something like the members profile page like as shown here.
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area

Basically, have you got any code in your login setup that is like this.

wixUsers.promptLogin( {"mode": "login"} ) 

Well, if you have, then you need to change the mode option to signup instead, see the API reference for more. https://www.wix.com/corvid/reference/wix-users.html#promptLogin

So it should say this instead.

wixUsers.promptLogin( {"mode": "signup"} )