Example #1
0
 /**
  * 执行新用户注册
  *
  */
 public function accountAction()
 {
     $email = $this->getRequest()->getPost('email');
     $password = $this->getRequest()->getPost('password');
     $repassword = $this->getRequest()->getPost('repassword');
     if (empty($email)) {
         Page::displayError('Please enter email');
     }
     if (empty($password)) {
         Page::displayError('Please enter password');
     }
     if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
         Page::displayError('Email format error');
     }
     if (strlen($password) < USER_PASSWORD_MIN || strlen($password) > USER_PASSWORD_MAX) {
         Page::displayError('Password length is not correct');
     }
     if ($password != $repassword) {
         Page::displayError('The two passwords do not match');
     }
     // 查询邮箱是否已经注册
     if ($this->models['userModel']->getUserByEmail($email)) {
         Page::displayError('Email registered');
     }
     // 写入数据
     $this->models['userModel']->newUser($email, $password);
     Page::displayMessage('Register successful', '/login');
 }
Example #2
0
 /**
  * 执行提交GIT数据
  *
  */
 public function doAction()
 {
     $data['title'] = $this->getRequest()->getPost('title');
     $data['categoryid'] = (int) $this->getRequest()->getPost('categoryid');
     $data['url'] = $this->getRequest()->getPost('url');
     $data['memo'] = $this->getRequest()->getPost('memo');
     $data['userid'] = Yaf\Registry::get('userInfo')['userid'];
     $data['dateline'] = TIMENOW;
     if (empty($data['title'])) {
         Page::displayError('Project name cannot be empty');
     }
     if (empty($data['categoryid'])) {
         Page::displayError('Please select a category');
     }
     if (empty($data['url'])) {
         Page::displayError('Project URL cannot be empty');
     }
     if (empty($data['memo'])) {
         Page::displayError('Project description cannot be empty');
     }
     $this->models['gitModel']->saveData($data);
     unset($data);
     Page::displayMessage('Successful submission Please wait for audit', '/add');
     return FALSE;
 }