0
votes

I would like to have my app send out a verification email when a user has registered. Current behaviour is that he is immediately (and automatically) logged in after registration. Whenever a user hits the registration button, I perform validation of the fields and call the 'Accounts.createUser' function. This works good. Note: am using a custom user authentication, not accounts-ui or useraccounts.

I would however prefer him to validate his email and only when this is successful, his account should be activated.

To achieve this I configured:

Accounts.config({
    sendVerificationEmail: true
});

The idea would be that an email is sent to the user in the Accounts.createUser function. My app is effectively sending out a verification email in the form 'http://localhost:3000/verify-email/' but the registered user is again automatically logged in.

  • Any ideas?
  • I have a route configured for the verification. Should I set the "verified" parameter (in mongo) to true via code in the js file of the template?
1
Thanks. I saw that one as well but I don't like the proposed solution. I understand the pubsub validations this person is proposing, but in no case a customer that has not been verified should get access to the backend. - wiwa1978

1 Answers

0
votes

try to use enforceEmailVerification: true check the docs https://github.com/meteor-useraccounts/core/blob/master/Guide.md