简体   繁体   English

流星帐户路由

[英]Meteor Accounts Routing

I use Meteor Accounts package but not the accounts-ui. 我使用Meteor Accounts软件包,但不使用account-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. 如果在创建用户时发送验证电子邮件,则在电子邮件中提供以下链接: http://localhost:3000/#/verify-email/06apVGBQypZAzpXZp4bPOYzn0-jCS9rR7ENkr8jkQRr如果打开此链接,则此路由将重定向到http://localhost:3000/#和我为/定义的模板。 I can then access the Accounts._verifyEmailToken thats not a problem. 然后,我可以访问Accounts._verifyEmailToken这不是问题。 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 )? 我如何说要重定向到我想要的路由的Accounts软件包(在我的情况下是/app )?

My attempts so far: 到目前为止,我的尝试:

  1. Redirect /# with iron router to /app ==> not working 使用铁路由器将/#重定向到/app ==>不起作用
  2. Having a look in the source code of accounts package. 看一下帐户包的源代码。 There are URLS provided with Meteor.absoluteUrl . Meteor.absoluteUrl提供了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? 您有什么想法让程序包随后路由到/app并且仍然可以在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. 只需覆盖服务器端的方法即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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