title = "Reset Password"; $this->description = "Request a password reset, once you got the e-mail address, you can choose a new password"; $this->icon = "user-lock"; $this->success = true; $this->message = ""; $this->token = NULL; } public function loadView() { parent::loadView(); if (isset($_GET["token"]) && is_string($_GET["token"]) && !empty($_GET["token"])) { $this->token = $_GET["token"]; $req = new \Api\User\CheckToken($this->getDocument()->getUser()); $this->success = $req->execute(array("token" => $_GET["token"])); if ($this->success) { if (strcmp($req->getResult()["token"]["type"], "password_reset") !== 0) { $this->success = false; $this->message = "The given token has a wrong type."; } } else { $this->message = "Error requesting password reset: " . $req->getLastError(); } } } protected function getAccountContent() { if (!$this->success) { $html = $this->createErrorText($this->message); if ($this->token !== null) { $html .= "Go back"; } return $html; } if ($this->token === null) { return "

Enter your E-Mail address, to receive a password reset token.

"; } else { return "

Choose a new password

"; } } }