Hi folks, I wonder if I can ask for some help, I think I’ve exhausted all the general information on this topic that I can find.
I have custom login and registration pages on my site , and as soon as custom forgot password comes along I’ll take advantage of it. All are working fine .
But.
The standard code misses the following 2 things and I realise I’ve exhausted my amateur coding knowledge trying to address it. If I’m duplicating it’s unintentional. I don’t think these have been covered on this forum, or if they have I haven’t found them.
I know this isn’t fatal, but I would like to address it. it just needs but I can’t seem to find a way to do this without relying on Wix Forms. Corvid basic forms example also doesn’t seem to provide this command. Have I missed something simple?
2. Field Attributes
Because Wix uses email ID not username I’d like to add an autocomplete attribute to the email field, otherwise, it’s not recognised by some password managers. I’ve tried various workarounds like renaming the field, changing the ID, none of which seem to work.
So then I started to try to mess around with aria labels. and failed.
Any suggestions?
Thanks for the comprehensive reply - have answered your follow-ups below.
2. Field Attributes
As for the use of regex on your user inputs,
I didn’t ask about regex, so that got me wondering, were you hinting at something like classify an email field as a password? Tried a bunch of iterations of that, and it still didn’t set the email ID to an autocomplete attribute equivalent of Username
But thanks - because otherwise, I’d never have found the simplest thing that does seem to work for Wix Email Usernames:
Placeholder text, in a text user ID field, with an email regex, does finally get recognised by chromium browsers as a valid UserID field
1. Form Warning
Finally, wi
th regards to your error message of ‘password field is not contained in a form’…
Simple corvid forms, using a lightbox, standard code eg.
I haven’t simply missed a corvid command that allows me to designate the whole thing as a ?
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) {
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("/mytribe");
})
.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..
});
}