Redirect User to Custom Page On Login

I’ve got a custom LogIn lightbox made (which works fine). What I need help with is how to use the email that’s logging in to redirect the member to a unique page I’ve created based on their email.

It’s the “wixLocation.to(‘/home’); })” that I need to change. Just don’t know how to have that change based on login email.

Example: John Doe uses his email to login and that sends him to mywebsite.com/john.doe Jane Doe uses her email to login and that sends her to mywebsite.com/jane.doe Those URLs would be pages I created for each member so as to show specific data for each of them.

(Note - I’m knew to this and not great at coding. Thank you in advance for the replies)

import wixUsers from ‘wix-users’;
import wixLocation from ‘wix-location’;

$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’);
})
})
})

You can easily redirect a user to their own page as shown in the members profile tutorial here.
https://support.wix.com/en/article/corvid-tutorial-building-your-own-members-area

export function profileButton_click(event) {   wixLocation.to(`/Members/${wixUsers.currentUser.id}`);
}

I would love to do that. My only issue is that I cannot make their members profile page autopopulate data that is not owned by them. As in, I’m inputting data and need to show each member a different/specific part of it. And I can’t figure out how to do that on their member profile page. So I wanted to link to a static page that I can link/customize their data to.

Okay, so if you wanted to filter a dataset by logged in user or by member added items only, then you can do it without code shown here.
https://support.wix.com/en/article/filtering-database-content-displayed-on-your-page

To search by email instead of id, then you can do that as well as shown in previous forum post here.
https://www.wix.com/corvid/forum/community-discussion/get-email-instead-an-id
https://www.wix.com/corvid/forum/community-discussion/getting-current-useremail-for-profile-page

You just really need to make sure that whatever you are adding is connected to the same email value as the user that it applies to, so that when you or the user searches by email address, then whatever is stored in a dataset that is connected to that users email will only be shown.