public function _pre() { $this->_setExceptionHandler(BackendExceptionHandler::class); $value = $this->request->getCookie("auth"); $newPwd = PasswordUtil::getPassword(); if ($value != md5($newPwd)) { throw new \Exception("timeout!"); } }
public function doAuthAction() { $password = $this->request->getPost("pwd"); $newPwd = PasswordUtil::getPassword(); if ($newPwd != $password) { throw new \Exception("System Err.1"); } $this->response->setCookie("auth", md5($newPwd), "/", TRUE); return $this->_alertRedirect("Success!", "/backend/welcome"); }