Z10987654321X
Z10987654321X

Reputation: 124

Parse server password reset email error ios

I have a Parse iOS App that I want users to be able to reset their account passwords with. I tried using the standard Parse Password Email Reset Function with this code. But it returned this error, "An appName, publicServerURL, and emailAdapter are required for password reset functionality.". I looked into this, and I found that I might need a MailGun or other email service to host my email resets. Is that true? Or is there another way I can address this error?

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

               print("Password Reset Email Sent")

           } else {


               print(error)
           }
       })

Upvotes: 0

Views: 526

Answers (1)

Faris
Faris

Reputation: 1236

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

}

Upvotes: 0

Related Questions