public function actionChange($email, $token) { try { $this->user = $this->userManager->findUserByEmail($email); } catch (\Exceptions\Runtime\UserNotFoundException $u) { $this->flashMessage('<strong>Chyba!</strong> Uživatel s E-mailem <strong>' . $email . '</strong> se v systému nenachází a proto není možné změnit heslo spojené s tímto E-mailem. V případě, že jste si jisti tím, že se v systému tento E-mail nacházel, zkuste pro více informací kontaktovat správce na adrese <strong>' . $this->systemEmail . '</strong>.', 'error'); $this->redirect('Password:reset'); } if ($this->user->token == NULL) { $this->flashMessage('<strong>Chyba!</strong> Nelze změnit heslo účtu spojeného s E-mailem <strong>' . $email . '</strong>. Zkuste si heslo znovu obnovit.', 'error'); $this->redirect('Password:reset'); } if ($this->user->token != $token) { $this->flashMessage('<strong>Chyba!</strong> Neoprávněný pokus o změnu hesla!', 'error'); $this->redirect('Password:reset'); } $currentTime = new \DateTime(); if ($currentTime > $this->user->tokenValidity) { $this->userManager->resetToken($this->user); $this->flashMessage('<strong>Chyba!</strong> Čas na změnu hesla vypršel. Pro obnovu hesla využijte formuláře níže.', 'error'); $this->redirect('Password:reset'); } $this['passwordChangeForm']['username']->setDefaultValue($this->user->username); $this['passwordChangeForm']['email']->setDefaultValue($this->user->email); }