Exemplo n.º 1
0
 /**
  * [checkcapAction description]
  * @return [type] [1 成功,10004 手机号未注册]
  */
 public function checkcapAction()
 {
     if (!$this->validFlag) {
         echo json_encode(array('ret' => 0, 'msg' => $this->warnMsg));
     } else {
         $objCaptcha = new Captcha();
         $key = 'resetPwd:' . $this->_sanReq['mobile'];
         $data = $objCaptcha->checkAllCaptcha($this->_sanReq['mobile'], $this->_sanReq['codeImg'], $key, $this->_sanReq['regtype'], $this->_sanReq['captcha']);
         if ($data == 1) {
             $user = new User();
             $res = $user->existTel($this->_sanReq['mobile']);
             if (!$res) {
                 echo json_encode(array('ret' => 0, 'msg' => array('email' => array('msg' => $this->di['sysconfig']['flagMsg']['10004']))));
             }
             $token = \Ucenter\Utils\Inputs::makeSecert($this->_sanReq['mobile'], $_SERVER['REQUEST_TIME']);
             $this->session->set('resetToken', $token);
             $this->session->set('resetMobile', $this->_sanReq['mobile']);
             $objCaptcha->delCaptchaRedisKey($key);
             echo json_encode(array('ret' => 1));
         } else {
             echo json_encode(array('ret' => 0, 'msg' => $data));
         }
     }
     exit;
 }
Exemplo n.º 2
0
 /**
  * 设一个隐藏标签regtype = 11
  * [checkcapAction 检查手机和验证码]
  * @return [type] [1验证码有效,]
  */
 public function checkcapAction()
 {
     if (!$this->validFlag) {
         echo json_encode(array('ret' => 0, 'msg' => $this->warnMsg));
     } else {
         $objCaptcha = new Captcha();
         $key = 'email:' . $this->session->get('uinfo')['mobile'];
         $data = $objCaptcha->checkAllCaptcha($this->session->get('uinfo')['mobile'], $this->_sanReq['codeImg'], $key, $this->_sanReq['regtype'], $this->_sanReq['captcha']);
         if ($data == 1) {
             $token = \Ucenter\Utils\Inputs::makeSecert($this->session->get('uinfo')['mobile'], $_SERVER['REQUEST_TIME']);
             $this->session->set('emailToken', $token);
             $objCaptcha->delCaptchaRedisKey($key);
             echo json_encode(array('ret' => 1));
         } else {
             echo json_encode(array('ret' => 0, 'msg' => $data));
         }
     }
     exit;
 }
Exemplo n.º 3
0
 public function addUserInfoAction()
 {
     if ($this->request->isPost() == true) {
         if (!$this->validFlag) {
             echo json_encode(array('ret' => 0, 'msg' => $this->warnMsg));
             $this->view->disable();
             return;
         } else {
             $user = new Users();
             $objCaptcha = new Captcha();
             $key = 'oauth:' . $this->_sanReq['mobile'];
             $data = $objCaptcha->checkAllCaptcha($this->_sanReq['mobile'], $this->_sanReq['codeImg'], $key, $this->_sanReq['regtype'], $this->_sanReq['captcha']);
             if ($data == 1) {
                 switch ($this->_sanReq['thirdType']) {
                     case 'qq':
                         $res = $user->qqRegister($this->_sanReq['passwd'], $this->_sanReq['mobile'], $this->_sanReq['email'], $pic = $this->_sanReq['pic'], $this->_sanReq['thirdOpenid']);
                         break;
                     case 'wb':
                         $res = $user->wbRegister($this->_sanReq['passwd'], $this->_sanReq['mobile'], $this->_sanReq['email'], $pic = $this->_sanReq['pic'], $this->_sanReq['thirdOpenid']);
                         break;
                     case 'wx':
                         $res = $user->wxRegister($this->_sanReq['passwd'], $this->_sanReq['mobile'], $this->_sanReq['email'], $pic = $this->_sanReq['pic'], $this->_sanReq['thirdOpenid']);
                         break;
                     case 'alipay':
                         $res = $user->alipayRegister($this->_sanReq['passwd'], $this->_sanReq['mobile'], $this->_sanReq['email'], $pic = $this->_sanReq['pic'], $this->_sanReq['thirdOpenid']);
                         break;
                     default:
                         $res = 0;
                         break;
                 }
                 if ($res == 1) {
                     $objCaptcha->delCaptchaRedisKey($key);
                     echo json_encode(array('ret' => 1));
                 } elseif ($res == 10002) {
                     echo json_encode(array('ret' => 0, 'msg' => array('mobile' => array('msg' => $this->di['sysconfig']['flagMsg']['10002']))));
                 } else {
                     echo json_encode(array('ret' => 0, 'msg' => array('service' => array('msg' => $this->di['sysconfig']['flagMsg']['10000']))));
                 }
                 $this->view->disable();
                 return;
             } else {
                 echo json_encode(array('ret' => 0, 'msg' => $data));
                 $this->view->disable();
                 return;
             }
         }
     } else {
         $tmpInfo = $this->cookies->get(substr(md5('tmpQqWb'), 8, 20));
         $info = json_decode(base64_decode($tmpInfo->getValue()));
         switch ($info->type) {
             case 'qq':
                 $typeMsg = 'QQ';
                 break;
             case 'wb':
                 $typeMsg = '微博';
                 break;
             case 'wx':
                 $typeMsg = '微信';
                 break;
             case 'alipay':
                 $typeMsg = '支付宝';
                 break;
             default:
                 $typeMsg = '';
                 break;
         }
         $this->view->setVar('third_type', $info->type);
         $this->view->setVar('third_openid', $info->uids);
         $this->view->setVar('pageTitle', "您已成功使用{$typeMsg} 账号登录到云朵,请先完善您的资料");
         $this->view->setVar('name', $info->name);
         $this->view->setVar('pic', $info->pic);
         $this->view->pick('index/adduserinfo');
     }
 }
Exemplo n.º 4
0
 /**
  * Captcha 1验证码有效 2验证码失效 3验证码错误 4需要图像验证码 5图像验证码错误
  */
 public function editPasswdAction()
 {
     if (!$this->validFlag) {
         echo json_encode(array('ret' => 0, 'msg' => $this->warnMsg));
     } else {
         $objCaptcha = new Captcha();
         $key = 'editPwd:' . $this->session->get('uinfo')['mobile'];
         $data = $objCaptcha->checkAllCaptcha($this->session->get('uinfo')['mobile'], $this->_sanReq['codeImg'], $key, $this->_sanReq['regtype'], $this->_sanReq['captcha']);
         if ($data == 1) {
             $users = new Users();
             $users->changePwd($this->session->get('uid'), $this->_sanReq['passwd']);
             $objCaptcha->delCaptchaRedisKey($key);
             echo json_encode(array('ret' => 1));
         } else {
             echo json_encode(array('ret' => 0, 'msg' => $data));
         }
     }
     $this->view->disable();
     return;
 }