It is not working! Is it working for you?
Hello,
Unfortunately, I can’t test this now, because my StillGrid account still isn’t ready. But I will send you a solution ASAP.
Hey man, any updates?
Hi,
does anyone have an example on how to send the verification email? Thanks
You can do it this way.
sendEmailVerification = async () => {
let user = Moralis.User.current(); // delete this if setted globaly
let userEmail = user.attributes.email;
await Moralis.User.requestEmailVerification(email)
.then(() => {
//user will get an email with a link. If the user clicks on the link his user get authenticated.
console.log("Successfully sent email verification email");
})
.catch((error) => {
// Show the error message somewhere
alert("Error: " + error.code + " " + error.message);
});
};
Also, check out the docs over here for more email authentication states. –
https://docs.moralis.io/moralis-server/users/email-login#verifying-emails
Hope this helps.
Happy BUIDLing!
Thanks, that works! Email was sent.
Do you know also how to do the verification itself? Where do I get the link for verification, …?
The verification is handled by Moralis itself. The link will be unique for each email being sent and will be embedded in the email. You need not manually work on it.
Happy BUIDLing !
@malik you guys should update the documentation to include that requestEmailVerification
needs to be explicitly called. From the docs, it seems like it says that the verification email will automatically be sent after calling signUp
Also, it seems that for people using webhooks like myself, the requestVerificationEmail
function is not present in moralis/node
:
Is there a chance this can be fixed? It’d be great that emails get automatically sent every time the user email
field changes.
I’m on "moralis": "^0.0.42"
.
For what it’s worth, I did check the JS in the node_modules
and the function is indeed not there.
If you make a new node project with npm init --yes
and npm install --save moralis
you don’t find that function there?
I don’t. And if I run the code the program crashes saying requestEmailVerification
is not a function. Are you able to confirm this on your end too?
These are the only references to requestEmailVerification
in the bundle:
I don’t see it included in moralis/node
there.
I tested this now:
const Moralis = require('moralis/node')
console.log(Moralis.User.requestEmailVerification)
=>
[Function: requestEmailVerification]
Hmmm - strange. Thanks for confirming. I’ll see what’s going on on my end and report what’s up.
Ok, just verified two things:
- The function is indeed there. I definitely had a problem locally with my deps + build.
-
requestEmailVerification
does not send the email. I verified thatrequestPasswordReset
does indeed work, so that ruled out that my email config was incorrect.
Any ideas?
you may need to add the email as parameter based on this response: Moralis is not sending email verification to users
Having this same issue as well trying to verify users with email.