/** * Password resrt form * * @author Aleh Hutnikau <*****@*****.**> * @return void */ public function resetPassword() { $token = $this->getRequestParameter('token'); $formContainer = new tao_actions_form_ResetUserPassword(); $form = $formContainer->getForm(); $form->setValues(array('token' => $token)); $user = $this->passwordRecoveryService->getUser(PasswordRecoveryService::PROPERTY_PASSWORD_RECOVERY_TOKEN, $token); if ($user === null) { \common_Logger::i("Password recovery token not found. Token value: {$token}"); $this->setData('header', __('User not found')); $this->setData('error', __('This password reset link is no longer valid. It may have already been used. If you still wish to reset your password please request a new link')); $this->setData('content-template', array('passwordRecovery/password-recovery-info.tpl', 'tao')); } else { if ($form->isSubmited() && $form->isValid()) { $this->passwordRecoveryService->setPassword($user, $form->getValue('newpassword')); \common_Logger::i("User {$user->uriResource} has changed the password."); $this->setData('info', __("Password successfully changed")); $this->setData('content-template', array('passwordRecovery/password-recovery-info.tpl', 'tao')); } else { $this->setData('form', $form->render()); $this->setData('content-template', array('passwordRecovery/password-reset.tpl', 'tao')); } } $this->setView('layout.tpl', 'tao'); }