问题描述
我正在使用 meteor 和 帐户密码 包.我正在滚动自己的登录名和密码更改/重置用户界面,想知道...
I am using meteor along with the accounts-password package. I'm rolling my own login and password changing/resetting UI and want to know...
如何自定义因 Accounts.resetPassword
而发送的重置密码电子邮件中的密码重置链接?
How can I customize the password reset link in the reset password email sent as a result of Accounts.resetPassword
?
目前它的格式如下:/#/reset-password/'
.由于我使用的是 meteor router,我想以 '/reset 的形式发送-password/<id>'
这样我就可以通过路由 '/reset-password/:id'
捕获它.
Currently it in the form like so: /#/reset-password/<id>'
. Since I am using meteor router, I would like to send in the form '/reset-password/<id>'
so I can catch it with the route '/reset-password/:id'
.
推荐答案
resetPassword:具有两个字段的对象:
- resetPassword.subject:一个函数,它接受一个用户对象并返回一个字符串作为重置密码电子邮件的主题行.
- resetPassword.text:一个接受用户对象和 url 并返回重置密码电子邮件正文的函数.
- resetPassword.subject: A Function that takes a user object and returns a String for the subject line of a reset password email.
- resetPassword.text: A Function that takes a user object and a url, and returns the body text for a reset password email.
您可以自定义将哪个 url 传递给重置密码电子邮件方法:
You can customise which url is passed to the reset password email method:
Accounts.resetPassword.text = function(user, url) {
return "Click this link to reset your password: /reset-password/" + myId;
}
这篇关于你如何在meteor中更改重置密码的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!