简体   繁体   中英

Meteor Accounts Routing

I use Meteor Accounts package but not the accounts-ui. If I send a verify email when user is created the following link is provided in the email: http://localhost:3000/#/verify-email/06apVGBQypZAzpXZp4bPOYzn0-jCS9rR7ENkr8jkQRr If I open this link this route is redirected to http://localhost:3000/# and the template I defined for / is rendered. I can then access the Accounts._verifyEmailToken thats not a problem. But I dont want this route /# to be taken.

How can I say the Accounts package that I want to be redirected to my the route I want (in my case /app )?

My attempts so far:

  1. Redirect /# with iron router to /app ==> not working
  2. Having a look in the source code of accounts package. There are URLS provided with Meteor.absoluteUrl . But I don't want to change the source code of the package.

What ideas do you have to let the package route to /app afterwards and still have the token accessable in javascript?

You can configure the url of the different mails in the Account package, like this

 Accounts.urls.verifyEmail= function(token){
    return Meteor.absoluteUrl("/app/"+token+"/");
 };

Just overwrite the method on the server side.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM