Quick question regarding email verification

Hi guys,

I have set up a very basic signup window with email verification. Following Corvid API to the letter . Yet it returns {‘approved’:false}. I’ve set member approval settings to manual from the dashboard-CustomerManagement-SiteMembers-SignupSettings.
The to-be-approved-user shows up in CRM and as a user to be approved. I’m guessing it has something to do with the doApproval(token) function?

Would be awesome if someone can help me out with this!

here is my signup page. It’s published:
http://nicholaspijpers.wixsite.com/idlylife/signup
post registration page:
http://nicholaspijpers.wixsite.com/idlylife/ post-register
and here is the code on three locations:
backend:

import wixUsersBackend from 'wix-users-backend';
export function registerUser(obj) {
let email = obj.email;
let password = obj.password;
let firstName = obj.firstName;
let lastName = obj.lastName;
let phone = obj.phone;
// Register user
return wixUsersBackend.register(email, password, {
'contactInfo': {
'firstName': firstName,
'lastName': lastName,
'phones': [phone]
}
})
//user registered, status PENDING
//send registration email
.then((results) => {
wixUsersBackend.emailUser('RuEc9z2', results.user.id, {
'variables': {
'name': firstName,
'verifyLink': 'nicholaspijpers.wixsite.com/idlylife/post-register?token=${results.approvalToken}`'
}
})
})
}
export function doApproval(token) {
//aprove the user
return wixUsersBackend.approveByToken(token)
//user now active but not logged in
//return sessio token to log in client side
.then((sessionToken) => {
return { sessionToken, "approved": true }
})
.catch((error) => {
return { "approved": false, "reason": error }
})
}

client signup:

import wixData from 'wix-data';
import wixUsers from 'wix-users';
import { registerUser } from 'backend/register'
$w.onReady(function () {
});
export function nextButton_click(event) {
$w("#emailAddress").updateValidityIndication();
if ($w("#emailAddress").validity.valid) {
let email = $w("#emailAddress").value
wixData.query("Users")
.eq("email", email)
.find()
.then((result) => {
console.log("NiNiNi")
if (typeof result.items[0] === 'undefined') {
$w("#emailBox").collapse();
$w("#detailsBox").expand();
} else {
$w("#nextButton").collapse();
$w("#emailExists").show();
$w("#loginButton").show();
$w("#password").expand();
}
})
.catch((error) => console.log(error))
}
}
export function nextButton2_click(event) {
validity();
if ($w("#phone").validity.valid, $w("#firstName").validity.valid, $w("#lastName").validity.valid, $w("#createPassword").validity.valid === true) {
$w("#detailsBox").collapse();
//SET LOADING SCREEEN
let obj = {};
obj.email = $w("#emailAddress").value;
obj.password = $w("#createPassword").value;
obj.phone = $w("#phone").value;
obj.firstName = $w("#firstName").value;
obj.lastName = $w("#lastName").value;
registerUser(obj)
}
}
function validity() {
$w("#countryCode").updateValidityIndication();
$w("#password").updateValidityIndication();
$w("#phone").updateValidityIndication();
$w("#firstName").updateValidityIndication();
$w("#lastName").updateValidityIndication();
}

client post registration:

import wixLocation from 'wix-location';
import wixUsersBackend from 'wix-users';
import { doApproval } from 'backend/register';
import wixData from 'wix-data';
$w.onReady(function () {
//get token
let token = wixLocation.query.token
doApproval(token)
.then((result) => {
console.log(result)
if (result.approved) {
//log user in
wixUsersBackend.applySessionToken(result.sessionToken)
console.log("approved")
} else {
console.log("not approved")
}
})
});

Answering my own question maybe? But would like to hear from Wix-Masters before implementing. I haven’t added a member Area to my page. As I would like to build one myself from scratch using my own user-collections. On another website I’m having problems removing the members area/privateCollection and it messes with the website flow and look. So before turning on this feature would be awesome to hear if this has anything to do with it. Thanks!!!

Tried turning on Member area. Member signup to Corvid, Custom and default, same issue. doApproval() returns false

f*** me. Typo in the verifyLink…

[‘nicholaspijpers.wixsite.com/idlylife/post-register?token=${results.approvalToken}']('nicholaspijpers.wixsite.com/idlylife/post-register?token=${results.approvalToken}’)

should be:

nicholaspijpers.wixsite.com/idlylife/post-register?token=${results.approvalToken}