profile->getUidByname($this->auth->getUid()); if (!isset($uGroups['groups'])) $uGroups['groups'] = 'anonymous'; $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action); if (!$falg) return Doo::acl()->defaultFailedRoute; } public function __construct() { $this->auth = new Auth(); $this->profile = new Uprofile(); $this->aconfig = new AConfig(); $this->data['rootUrl'] = Doo::conf()->APP_URL; } // public function Signup() { // $this->render('login', $this->data); // } // public function beforeRun($resource, $action) { // $uname = $this->auth->getUname(); // if ($uname) { // $uGroups = $this->users->getUidByname($this->auth->getUname()); // } else { // $uGroups['groups'] = 'anonymous'; // } // $falg = Doo::acl()->isAllowed($uGroups['groups'], $resource, $action); // if (!$falg) // return Doo::conf()->APP_URL; // } public function welcome() { $this->render('welcome', $this->data); } public function Signin() { $this->data['tips'] = ''; // 密码采用PHPASS // 防止跨站采用user_agent随机串 // 重复提交CRSF_FORM // 自动登录 可采用登录后生成一个可验证字符串,要求输入密码可通过网上登录查看(从客户端点击)加验证码 // if ($this->auth->isLoggedIn()) // return Doo::conf()->APP_URL . 'project/welcome'; if (isset($_POST['uemail']) && isset($_POST['upasswd'])) { if ($this->isValidFormHash($_POST['tokenform'])) { $retval = $this->auth->checkLogin($_POST['uemail'], $_POST['upasswd']); if (isset($retval['uid'])) { $this->auth->setUid($retval['uid']); $this->auth->setUemail($retval['uemail']); $_SESSION['token'] = sha1($this->create_randomstr() . $_SESSION['uid']); setcookie('token', $_SESSION['token'], 0, '/', Doo::conf()->APP_URL, FALSE, TRUE); // $profileArray = $this->profile->getProWithUid($this->auth->getUid()); // if (isset($profileArray['userid'])) { return Doo::conf()->APP_URL . 'project/index'; // } else { // return Doo::conf()->APP_URL . 'project/welcome'; // } // die(); } else { $this->data['tips'] = '