public function testResetPassword() { $this->_user->save(); $oldPwd = $this->_user->password; $this->_user->password = "******"; $user = $this->_service->resetPassword($this->_user); $this->assertNotEquals($this->_user->password, $oldPwd); $this->assertEquals($this->_user->password, "NEW PASSWORD"); $this->_user->password = $oldPwd; $this->_user->save(); }
public function resetPasswordAction() { if ($this->getRequest()->isPost()) { $data = $this->_helper->requestData(); $userId = $data['userId']; if (!$userId) { throw new InvalidArgumentException("userId parm not given"); } $user = $this->_userSrv->load($userId); $this->_helper->allowed('resetPassword', $user); try { $this->_userSrv->resetPassword($user); $this->view->data = true; } catch (\Exception $e) { throw new UnexpectedException("Unable to send email"); } } else { throw new ForbiddenException("ResetPassword action must be a post request"); } }
/** * */ public function unblockAction() { /** * @var $user \Application\Model\UserModel */ $user = $this->_getUser(); $this->_helper->allowed('unblock', $user); if ($user->status !== \Application\Model\UserModel::USER_STATUS_BLOCKED) { throw new InvalidArgumentException("Invalid parameter value unblock: unblockUser"); } $this->_userSrv->resetPassword($user); }