Parse open source server reset password error

喜欢而已 提交于 2019-11-30 17:03:58

Did you set up the email adapter?

Take a look at : https://github.com/ParsePlatform/parse-server

Email verification and password reset

Verifying user email addresses and enabling password reset via email requries an email adapter. As part of the parse-server package we provide an adapter for sending email through Mailgun. To use it, sign up for Mailgun, and add this to your initialization code:

var server = ParseServer({
  ...otherOptions,
  // Enable email verification
  verifyUserEmails: true,
  // The public URL of your app.
  // This will appear in the link that is used to verify email addresses and reset passwords.
  // Set the mount path as it is in serverURL
  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',
    }
  }
});

You can also use other email adapters contributed by the community such as parse-server-sendgrid-adapter or parse-server-mandrill-adapter.

Add this to the instantiation of the parse server, if you download the parse-server from git it will originally look like below.

var api = new ParseServer({
  serverURL: process.env.SERVER_URL,
  databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || '' //Add your master key here. Keep it secret!
});

So append the first code snippet to the bottom of the above sample.

var api = new ParseServer({
    serverURL: process.env.SERVER_URL,
    databaseURI: databaseUri || 'mongodb://localhost:27017/dev',
    cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
    appId: process.env.APP_ID || 'myAppId',
    masterKey: process.env.MASTER_KEY || '', //Add your master key here. Keep it secret!
    verifyUserEmails: true,
    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',
        }
    }
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!