我在Heroku Parse-Server上运行迁移的应用程序。当我尝试使用'requestPasswordResetInBackground'从我的应用程序发送密码重置电子邮件时,我收到以下错误:
“密码重置功能需要appName,publicServerURL和emailAdapter。”。
它曾经在Parse.com上正常工作。
我已经阅读了有关实现此缺失功能的举措。有人知道这样的实现是否已经可用或将很快,如果是,如何配置它?
谢谢!
答案 0 :(得分:3)
然后,您需要阅读自述文件以进行解析迁移 https://github.com/ParsePlatform/parse-server/blob/master/README.md。有一个mailgun的例子。它位于Parse Server中,因此您无需在index.js上安装任何额外的模板或需要一些东西。
在index.js中添加以下代码。它应该在您的服务器初始化之后
var server = ParseServer({
//... your other configurations
// here the configuration for email begins
verifyUserEmails: true, //depends on your needs, you can set it to false
emailVerifyTokenValidityDuration: 2 * 60 * 60, // in seconds (2 hours = 7200 seconds)
preventLoginWithUnverifiedEmail: false, // defaults to false
publicServerURL: 'https://example.com/parse',
// Your apps name. This will appear in the subject and body of the emails that are sent.
appName: 'Parse App',
// The email adapter
emailAdapter: {
module: 'parse-server-simple-mailgun-adapter',
options: {
// The address that your emails come from
fromAddress: 'parse@example.com',
// Your domain from mailgun.com
domain: 'example.com',
// Your API key from mailgun.com
apiKey: 'key-mykey',
}
}
在Parse服务器中更改更新的index.js后,您将能够从mailgun获取电子邮件。收到电子邮件可能需要几分钟时间。
然后,您还需要在自己的服务器上实现电子邮件重置html页面。我还没有找到一个好的教程。
如果你直接由Heroku安装了Parse服务器,你将拥有 server.js 而不是 index.js ,你可以在这个目录中找到它:/ opt / bitnami / apps / parse / htdocs /并执行此文件中的所有更改并重新启动服务器