Не получаю пароль для сброса почты Firebase - PullRequest
0 голосов
/ 18 октября 2018

Изображение пытается реализовать функцию "забыл пароль" в моем приложении.Но почта сброса не отправляется.Код неправильный?Или я должен настроить что-то в Firebase, чтобы это работало?

  @IBAction func forgotPasswordButton(_ sender: UIButton) {
        let forgotPasswordAlert = UIAlertController(title: "Forgot password?", message: "Please enter registerd email address", preferredStyle: .alert)
        forgotPasswordAlert.addTextField { (textField) in
            textField.placeholder = "Email address"
        }
        forgotPasswordAlert.addAction(UIAlertAction(title: "Cancel", style: .cancel, handler: nil))
        forgotPasswordAlert.addAction(UIAlertAction(title: "Reset Password", style: .default, handler: { (action) in
            let email = forgotPasswordAlert.textFields?.first?.text
            Auth.auth().sendPasswordReset(withEmail: email!, completion: { (error) in
                DispatchQueue.main.async {

                    if let error = error {
                        let resetFailedAlert = UIAlertController(title: "Reset Failed", message: error.localizedDescription, preferredStyle: .alert)
                        resetFailedAlert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
                        self.present(resetFailedAlert, animated: true, completion: nil)
                    } else {
                        let resetEmailSentAlert = UIAlertController(title: "Reset email sent successfully", message: "Check your email", preferredStyle: .alert)
                        resetEmailSentAlert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
                        self.present(resetEmailSentAlert, animated: true, completion: nil)
                    }
                }
            })
        }))

        self.present(forgotPasswordAlert, animated: true, completion: nil)
    }
...