In the service where you add the user record, add a column for secret code.
In the mapping event prior to add, for that column, add this code:
return fcreatcode()
function fcreatecode() {
return Math.floor((Math.random() * 1000000) + 1).toString().trim();
}
In the success event for the user registration or add service, call the service to email the secret code to the user ... Based on the value in the column.... Which perhaps you saved to local storage in the function call above??
If you're interested in an entire login mechanism with registration code verification, Facebook login, etc .... I hage that available on my website for my consulting clients.
Send me an email if youd like to know more.
Best,
Bruce