如何更改meteor中的重置密码URL? [英] How do you change the reset password URL in meteor?

查看:98
本文介绍了如何更改meteor中的重置密码URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 meteor 以及帐户密码包。我正在滚动我自己的登录和密码更改/重置UI并想知道...

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?

目前它的形式如下: /#/复位密码/< ID>'。由于我使用流星路由器,我想以的形式发送'/ 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'.

推荐答案

请参阅有关电子邮件模板的部分Meteor文档


resetPassword:包含两个字段的对象:

resetPassword: An Object with two fields:


  • resetPassword.subject:一个函数,它接受用户对象并返回重置密码电子邮件主题行的字符串。

  • resetPassword.text:获取用户对象和网址的函数,并返回重置密码电子邮件的正文文本。

  • 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.

您可以自定义将哪个网址传递给重置密码电子邮件方法:

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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆