/** * * @param Command $command */ private function savePassword(Command $command) { $hash = $command->entity()->getPassword(); if (!HashPass::verifyPassword($this->http->request->get('userPassword'), $hash)) { Server::setReferData(['error' => ['validPassword' => 1]]); Server::headerLocationReferer(); } else { $command->setPassword($this->http->request->get('userNewPassword'))->update(['password' => []]); } }
/** * * @return integer */ private function getUserId() : int { $this->query->setQuery('user')->findBy($this->column, $this->login); $result = $this->query->getStaticQuery(); if (count($result) === 1 && HashPass::verifyPassword($this->password, $result[0]->getPassword())) { $this->userEntity = $result[0]; return $this->userEntity->getId(); } return 0; }
/** * Set hashed password * * @param string $password * * @return Users */ public function setPassword($password) { $this->password = HashPass::hash($password); return $this; }