I have a custom signup and login on my site made using Velo. So for the Wix login and signup forms, I changed them to be like no permission messages. However, when I go to my homepage after a few seconds it gives me the no permissions (which would be the standard Wix signup lightbox (modified by me), I think). Then, on the lightbox I have a button to take you back home. When I press that button, it takes me back to the homepage and then no longer shows me the signup lightbox thing - it works as it should.
My second issue related to this was that on my own page that i use to log people in, the one made using Velo, when the “login” button is pressed, it redirects me to Wix’s standard login lightbox. Once I X out of it, then press login again, everything works as it should.
Here is the code I use for the login page:
import { getToken } from 'backend/MemberBackend';
import { authentication } from 'wix-members';
import wixLocation from 'wix-location';
$w.onReady(function () {
$w('#login').onClick(async () => {
let username = $w('#username').value.trim();
let password = $w('#password').value.trim();
let loginResult = await getToken(username, password);
if (loginResult.approved) {
authentication.applySessionToken(loginResult.sessionToken);
wixLocation.to('/my-profile');
} else {
console.log(loginResult.err)
$w('#errText').show();
$w('#errText').text = loginResult.err;
}
});
});
And the function from the backend:
export async function getToken(username,password) {
let email = await getEmail(username);
let sessionToken;
try {
sessionToken = await authentication.login(email,password);
return {
sessionToken: sessionToken,
approved: true
}
} catch (err) {
return {
approved: false,
err: err
}
}
}
Why are these issues happening? (Note: the permissions for both pages are for everyone). Please get back to me ASAP. Thanks so so much in advance.