流星通过使用“忘记密码”功能发送错误生成的链接(#)
问题描述:
我激活“忘记密码?”功能。在流星。我在我的收件箱里收到一封来自流星的电子邮件,重置密码,一切都很好,但问题出在生成的链接上,因为我在链接中获得了#。 (见中的链接)流星通过使用“忘记密码”功能发送错误生成的链接(#)
http://localhost:3000/#/reset-password/8DhEtotkn0A0EU-
kShhmB6llHlfXpXCXAIqNYvrsZzi
当我从上面的链接删除#和copypaste在浏览器中的链接,然后它的正常工作。
哪里来#在链接?以及如何在我的流星项目中将其删除以正确链接到其他密码?需要
的帮助,感谢
答
您可以使用Accounts.urls.resetPassword
功能
在你server/main.js
文件中插入下面的代码更改此:
Meteor.startup(function() {
Accounts.urls.resetPassword = function(token) {
return Meteor.absoluteUrl('reset-password/' + token);
};
});
你可以设置你想上面的任何URL。
你也可以添加更多的信息来定制的电子邮件,如果你想:
Meteor.startup(function() {
Accounts.urls.resetPassword = function(token) {
return Meteor.absoluteUrl('reset-password/' + token);
};
Accounts.emailTemplates.siteName = "Your Application Name";
Accounts.emailTemplates.from = "Application Name <[email protected]>";
});
这是由'账户,base'默认生成的链接。它是由'accounts-client'挑选的,并且调用你可能已经用'Accounts.onResetPasswordLink()'注册过的任何回调。你是如何设置重置处理过程的? – MasterAM
我使用了https://www.mailgun.com/。我只添加了这个 process.env.MAIL_URL =“smtp://postmaster%40sandbox202f4c3b9d397531e92b47ef.mailgun.org:[email protected]:587/”; – AhmyOhlin
如何获得设置accounts.onResetPasswordLink()? 我可以在哪里找到令牌? – AhmyOhlin