src/Module/Authentication/LocalAuth/PasswordReset.php
protected function beginPasswordReset()
    {
        // Check if password reset is enabled
        if (!$this->config["enabled"]) {
            return;
        }
        $this->picoAuth->addAllowed("password_reset");
        $this->picoAuth->setRequestFile($this->picoAuth->getPluginPath() . '/content/pwbeginreset.md');

        if (count($this->session->getFlash('_pwresetsent'))) {
            $this->picoAuth->addOutput("resetSent", true);
            return;
        }

        $post = $this->httpRequest->request;
        if ($post->has("reset_email")) {
            // CSRF validation
            if (!$this->picoAuth->isValidCSRF($post->get("csrf_token"))) {
                $this->picoAuth->redirectToPage("password_reset");
            }

            $email = trim($post->get("reset_email"));
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
                $this->session->addFlash("error", "Email address does not have a valid format.");
                $this->picoAuth->redirectToPage("password_reset");
            }

            // Check if the action is not rate limited
            if (!$this->limit->action("passwordReset", true, array("email" => $email))) {
                $this->session->addFlash("error", $this->limit->getError());
                $this->picoAuth->redirectToPage("password_reset");
            }

            if ($userData = $this->storage->getUserByEmail($email)) {
                $this->sendResetMail($userData);
            }

            // Always display a message with success
            $this->session->addFlash("_pwresetsent", true);
            $this->session->addFlash("success", "Reset link sent via email.");
            $this->picoAuth->redirectToPage("password_reset");
        }
    }
protected function beginPasswordReset()
    {
        // Check if password reset is enabled
        if (!$this->config["enabled"]) {
            return;
        }
        $this->picoAuth->addAllowed("password_reset");
        $this->picoAuth->setRequestFile($this->picoAuth->getPluginPath() . '/content/pwbeginreset.md');

        if (count($this->session->getFlash('_pwresetsent'))) {
            $this->picoAuth->addOutput("resetSent", true);
            return;
        }

        $post = $this->httpRequest->request;
        if ($post->has("reset_email")) {
            // CSRF validation
            if (!$this->picoAuth->isValidCSRF($post->get("csrf_token"))) {
                $this->picoAuth->redirectToPage("password_reset");
            }

            $email = trim($post->get("reset_email"));
            if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
                $this->session->addFlash("error", "Email address does not have a valid format.");
                $this->picoAuth->redirectToPage("password_reset");
            }

            // Check if the action is not rate limited
            if (!$this->limit->action("passwordReset", true, array("email" => $email))) {
                $this->session->addFlash("error", $this->limit->getError());
                $this->picoAuth->redirectToPage("password_reset");
            }

            if ($userData = $this->storage->getUserByEmail($email)) {
                $this->sendResetMail($userData);
            }

            // Always display a message with success
            $this->session->addFlash("_pwresetsent", true);
            $this->session->addFlash("success", "Reset link sent via email.");
            $this->picoAuth->redirectToPage("password_reset");
        }
    }
The first stage of a password reset process

Shows a form to request a password reset and processes
its submission (sends password reset link on success)

@return void