public function recovery2FormSucceeded($form, $values) { $userData = $this->model->getBy(array("email" => $values->username)); if (!$userData) { $this->flashMessage("Neznámé uživatelské jméno.", "danger"); $this->redirect("password"); } else { try { $id = $userData->id; $this->localUserModel->setPassword($id, $values->password); $this->localUserModel->removeToken($id); $this->flashMessage("Změna hesla proběhla úspěšně.", "success"); } catch (Exception $e) { $this->flashMessage("Při nastavování hesla došlo k chybě.", "danger"); } } $this->redirect("in"); }
public function passwordFormSucceeded($form, $values) { $id = $this->user->id; unset($values->id); $data = $this->model->get($id); if ($data) { if ($data->email) { try { $this->localUserModel->add($id, $values->password); $this->flashMessage("Heslo bylo nastaveno.", "success"); $this->redirect("default"); } catch (Exception $e) { $this->flashMessage("Nastavení hesla se nepodařilo.", "danger"); } } else { $this->flashMessage("Nemáte nastavenou emailovou adresu. Není ji tak možné ho použít jako přihlašovací jméno.", "danger"); } } else { $this->flashMessage("Takový účet neexistuje.", "warning"); } $this->redirect("default"); }