What is the problem with this code?

I have absolutely zero knowledge of coding and have copied the code snip and made changes after reading from multiple forums but its not working as I want it to.

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

$w . onReady ( function (){
$w ( ‘#registerNow’ ). onClick ( function (){
let firstname = $w ( ‘#registerFirst’ ). value ;
let lastname = $w ( ‘#registerLast’ ). value ;
let contact = $w ( ‘#registerContact’ ). value ;
let email = $w ( ‘#registerEmail’ ). value ;
let password = $w ( ‘#registerPassword’ ). value ;
let confirmpassword = $w ( ‘#registerConfirm’ ). value ;
// Here we create the contactInfo Object
let contactInfo = {
“firstname” : firstname ,
“lastname” : lastname ,
“contact” : contact ,
“confirmpassword” : confirmpassword
[}](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[wixUsers](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [.](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [register](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [(](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [email](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [,](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [password](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [,](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [contactInfo](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [)](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[.](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [then](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [(()=>{](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[wixLocation](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [.](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [to](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [(](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [‘/Registration_moreinfo’](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [);](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[})](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[})](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[})](}
wixUsers.register(email,password,contactInfo)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))

In custom registration, I want to register First name, last name, contact info, email, password and want the person to confirm his or her password. but I am getting the error of " Type ‘{ firstname: string; lastname: string; contact: string; confirmpassword: string; }’ has no properties in common with type ‘RegistrationOptions’. "

I have zero idea of the fix. pls help. Thanks in advance.

I also need the users to be able to reset their passwords for the forgot password using their mail id or mobile number in custom login how to do that? the code snip of login is below

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]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [(]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [‘#loginPassword’]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [).]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [value]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [;]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
}))

[wixUsers]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [.]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [login]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [(]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [email]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [,]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [password]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [)]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
}))
[.]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [then]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [(()=>{]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
}))
[wixLocation]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [.]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [to]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [(]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [‘/premium_Members’]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
})) [);]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
}))
[})]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
}))
[})]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
}))
[})]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/premium_Members’);
})
})
}))
The login options asks the users to login twice for some reason, I tried to check and did the recommended fixes but it still asks to login twice every 3 login attempt. I tired clearing cache and cookies and even incognito but issue still persists

The website is rkpoints if needed

It’s case sensitive, and you used firstname instead of firstName etc…

It’s not working, I had tried it already, but the error " Type ‘{ firstname: string; lastname: string; contact: string; confirmpassword: string; }’ has no properties in common with type 'RegistrationOptions " still remains

The contactInfo object should be inside the RegistrationOptions object, so you need something like this:

wixUsers.register(email, password, {contactInfo: contactInfo})

For details, see the register() API. The example code snippet from the API:

let email = // the user's email addresses
let password = // the user's password
let firstName = // the user's first name
let lastName = // the user's last name
let phone =  // the user's phone number

wixUsers.register(email, password, {
    contactInfo: {
        "firstName": firstName,
        "lastName": lastName,
        "phones": [phone]
    }
  } )
  .then( (result) => {
    let resultStatus = result.status;
  } );

Thanks @yisrael-wix , It worked. Can we make a forgot password section such that the person gets otp on mail or phone?

And what’s the reason for double login issue?

The double login issue might be a result of the page’s onReady() function running twice - once in the backend (server side) and then again in the frontend (browser side). See the article Preventing Unwanted Side Effects for further explanation. See Rendering API Example for a possible solution to your problem.

I’m not aware of any way to create a custom “forgot my password” mechanism, but I would suggest contacting Wix Customer Care to see if they have any suggestions.

Thanks again @yisrael-wix I couldn’t really understand the rendering of API part but I’ll read on it and fix it.

@yisrael-wix My login has stopped working after I made changes in my member registration form, I don’t understand what went wrong. Also is it possible to redirect the website members to a profile creation page on their first login and from second login onward redirect them to their profile page? If yes then how, pls help with the code snip if possible this is the code I am using for login

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]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [(]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [‘#loginPassword’]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [).]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [value]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [;]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))

[wixUsers]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [.]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [login]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [(]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [email]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [,]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [password]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [)]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[.]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [then]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [(()=>{]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[wixLocation]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [.]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [to]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [(]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [‘/Registration_moreinfo’]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
})) [);]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[})]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[})]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))
[})]($w(‘#loginPassword’).value;

wixUsers.login(email,password)
.then(()=>{
wixLocation.to(‘/Registration_moreinfo’);
})
})
}))

The custom registration code

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

$w . onReady ( function (){
$w ( ‘#registerNow’ ). onClick ( function (){
let firstName = $w ( ‘#registerFirst’ ). value ;
let lastName = $w ( ‘#registerLast’ ). value ;
let contact = $w ( ‘#registerContact’ ). value ;
let email = $w ( ‘#registerEmail’ ). value ;
let password = $w ( ‘#registerPassword’ ). value ;
let confirmPassword = $w ( ‘#registerConfirm’ ). value ;
wixUsers . register ( email , password ,{
contactInfo : {
// Here we create the contactInfo Object
“firstName” : firstName ,
“lastName” : lastName ,
“phones” : [ contact ],
}

})
. then (()=>{
wixLocation . to ( ‘/Members’ );
})
})
})