Hello guys, somebody could help me?
I would had an email verification when the member register himself and also i would syncronize all the ContactInfo such as City, State, telephone and Address in Wix CRM.Thank you so much.
import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixCRM from 'wix-crm';
export function button68_click(event) {
$w("#cognome").required = true;
$w("#Nome").required = true;
let label;
let unformattedUserEmail = $w("#email").value;
let formattedUserEmail = (unformattedUserEmail).toLowerCase();
console.log(formattedUserEmail);
//query the user database to ensure the new user email has not been previously been used to register
wixData.query("Account")
.eq("email", (formattedUserEmail))
.limit(1)
.find()
.then((results) => {
let emailPreviouslyRegistered = results.totalCount
let validityObj = $w("#Nome").validity;
let validityObj1 = $w("#cognome").validity;
let validityObj2 = $w("#Paese").validity;
let validityObj3 = $w("#indirizzo").validity;
let validityObj4 = $w("#cap").validity;
let validityObj5 = $w("#email").validity;
let validityObj6 = $w("#telefono").validity;
let validityObj7 = $w("#password").validity;
validityObj = {
tooShort: 1
}
validityObj1 = {
tooShort: 1
}
validityObj2 = {
tooShort: 1
}
validityObj3 = {
tooShort: 1
}
validityObj4 = {
tooShort: 1
}
validityObj5 = {
tooShort: 1
}
validityObj6 = {
tooShort: 1
}
validityObj7 = {
tooShort: 1
}
if (emailPreviouslyRegistered === 0) {
$w('#text62').hide();
if ($w('#checkbox2').checked === false) {
$w('#text60').show();
} else {
if ($w('#Nome').valid === true) {
$w('#text60').hide();
$w('#text58').show();
} else {
$w('#text60').hide();
if (('#cognome').valid === true) {
$w('#text58').show();
} else {
if (($w('#indirizzo').valid === true)) {
$w('#text58').show();
} else {
if (($w('#Paese').valid === true)) {
$w('#text58').show();
} else {
if (($w('#cap').valid === true)) {
$w('#text58').show();
} else {
if (($w('#email').valid === true)) {
$w('#text58').show();
} else {
if (($w('#telefono').valid === true)) {
$w('#text58').show();
} else {
if (($w('#password').valid === true)) {
$w('#text58').show();
} else {
$w('#text60').hide();
$w('#text58').hide();
wixUsers.register($w('#email').value, $w('#password').value, $w('#Nome'), $w('#cognome'), $w('#Nazione'), $w('#indirizzo'), $w('#telefono'), $w('#Paese'), $w('#cap'), {
"contactInfo": {
"Nome": [$w('#Nome').value],
"Cognome": $w('#cognome').value,
"email": [$w('#email').value],
"Nazione": $w('#Nazione').value,
"Indirizzo": $w('#indirizzo').value,
"Telefono": $w('#telefono').value,
"Città": $w('#Paese').value,
"Cap": $w('#cap').value,
"Label":["Privato"]
}
})
.then((result) => {
let status = result.status; // "Pending"
let approvalToken = result.approvalToken;
let user = result.user; {
$w('#text59').show('slide', SlideOptions);
$w('#box4').hide('slide', slideOptions)
}
})
}
}
}
}
}
}
}
}
}
} else {
$w('#text62').show();
console.log('Email già usata')
}
})
}
Check out the Users API here. Search for "Register a user sending an email for confirmation" for explanation about it.
Please somebody can help me?
did you get this working yet? I am trying to do the same thing but can't write to the CRM fields for address, city, state, zip or phones. I had to create custom fields called homeCity, homeState, etc, to workaround but it still leaves the default CRM fields blank, which is annoying.
UPP!Help please!