【问题标题】:Parse server password reset email error ios解析服务器密码重置电子邮件错误 ios
【发布时间】:2016-10-06 03:24:34
【问题描述】:

我有一个 Parse iOS 应用程序,我希望用户能够使用它来重置他们的帐户密码。我尝试使用带有此代码的标准解析密码电子邮件重置功能。但它返回了这个错误,“密码重置功能需要一个 appName、publicServerURL 和 emailAdapter。”。我对此进行了调查,发现我可能需要 MailGun 或其他电子邮件服务来托管我的电子邮件重置。真的吗?还是有其他方法可以解决此错误?

PFUser.requestPasswordResetForEmailInBackground(myEmail, block: { (success, error) -> Void in
           if error == nil {

               print("Password Reset Email Sent")

           } else {


               print(error)
           }
       })

【问题讨论】:

  • 如果我理解正确,您正在寻找一种无需任何电子邮件服务/提供商即可发送电子邮件的方法?
  • 我相信,您必须在解析服务器上创建一个邮件服务器适配器。 Mailgun 为开发目的提供免费帐户
  • 您的解析服务器是托管在本地还是托管在其他解决方案上,例如 Heroku 或 AWS?
  • 感谢您的反馈!我的解析服务器在本地托管。是否有任何替代邮筒的服务,或者它们本身是否是有信誉和可靠的来源?
  • 好的,鳗鱼你必须在你的服务器文件中添加一个邮件服务器适配器:)

标签: ios swift parse-platform passwords parse-server


【解决方案1】:

// MARK: - 忘记密码按钮

@IBAction func forgotPasswButt(_ sender: AnyObject) {
    let alert = UIAlertController(title: APP_NAME,
                                  message: "Type your email address you used to register.",
                                  preferredStyle: .alert)


    let ok = UIAlertAction(title: "Reset password", style: .default, handler: { (action) -> Void in
        // TextField (optional))
        let textField = alert.textFields!.first!
        let txtStr = textField.text!

        PFUser.requestPasswordResetForEmail(inBackground: txtStr, block: { (succ, error) in
            if error == nil {
                self.simpleAlert("You will receive an email shortly with a link to reset your password")
            }})
    })

    // Cancel button
    let cancel = UIAlertAction(title: "Cancel", style: .destructive, handler: { (action) -> Void in })

    // Add textField
    alert.addTextField { (textField: UITextField) in
        textField.keyboardAppearance = .dark
        textField.keyboardType = .default
    }

    alert.addAction(ok)
    alert.addAction(cancel)
    present(alert, animated: true, completion: nil)

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多