0
votes

i create an user signup and send verification email, in email that user received :

Hello Derp,
To verify your account email, simply click the link below.
http://sijie.meteor.com/#/verify-email/pd65W2yQ8tKTd6XbF
Thanks.

after i click that link, i think the email address must be verified but i check on mongo, still verify : false

"emails" : [
        {
            "address" : "[email protected]",
            "verified" : false
        }
    ],

why this happened? how to verify user after he click on the link?

thanks

2

2 Answers

3
votes

The url will work automatically if you are using the accounts-ui or accounts-ui-unstyled packages.. other wise you have to call Accounts.verifyEmail with the token which is stored in Accounts._verifyEmailToken on the client side.

They way they do this in accounts ui is to check on start up if Accounts._verifyEmailToken exists and if so call Accounts.verifyEmail.

From: https://github.com/meteor/meteor/blob/4d45f2426057d882a225fe7fc57eba45f1d4cd26/packages/accounts-ui-unstyled/login_buttons_dialogs.js#L23

Meteor.startup(function () {
  if (Accounts._verifyEmailToken) {
    Accounts.verifyEmail(Accounts._verifyEmailToken, function(error) {
      Accounts._enableAutoLogin();
      if (!error)
        loginButtonsSession.set('justVerifiedEmail', true);
      // XXX show something if there was an error.
    });
  }
});
0
votes

You probably need to use this method manually: Accounts.verifyEmail
You can do it in your onBeforeAction if you use IronRouter.