meteor-useraccounts / flow-routing

Useraccounts packages add-on for integration with Flow Router and Blaze Layout.
https://atmospherejs.com/useraccounts/flow-routing
MIT License
72 stars 50 forks source link

Usage Question: Verify Email #39

Closed GerhardJO closed 8 years ago

GerhardJO commented 8 years ago

Hello,

Thanks for this awesome meteor package. I was able to configure my app to send a verification email and was able to send the mail using my Mailgun sandbox domain.

The verification link I receive looks as follows http://localhost:3000/#/verify-email/ Clicking this link just takes the user to the Home route.

Does flow-routing handle the verification callback or should I implement it myself?

Thanks

nicooprat commented 8 years ago

Same problem here, no clue how to do :(

GerhardJO commented 8 years ago

Hi @nicooprat

Thanks for reminding me to look into this again. The answer is indeed to implement the verification callback as described in: http://docs.meteor.com/api/passwords.html#Accounts-onEmailVerificationLink and in the callback calling: http://docs.meteor.com/api/passwords.html#Accounts-verifyEmail

I'm assuming without testing that this will be the same for all the Accounts-Password callbacks.

Implement the code below in client code but not in client.startup as per the docs.

Accounts.onEmailVerificationLink(function(token){
  console.log(token);
  Accounts.verifyEmail(token, function(Error){
     if(Error){
       console.log(Error);
     }
  });
});

[Edit] Also remember to add the router override. For useraccounts:flow-routing like I'm using you'll need to add AccountsTemplates.configureRoute('verifyEmail'); to your routing code. Cheers

nicooprat commented 8 years ago

Right, thanks! I'll add that the route override must be accessible in client and server side.