解析服务器密码重置电子邮件错误ios

时间:2016-10-06 03:24:35

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

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

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

               print("Password Reset Email Sent")

           } else {


               print(error)
           }
       })

1 个答案:

答案 0 :(得分:0)

// MARK: - FORGOT PASSWORD BUTTON

@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)

}