/** * [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; }
/** * 设一个隐藏标签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; }
/** * [changePwd description] * @param [string] $uid [用户id] * @param [string] $newPwd [新密码] * @param [string] $regtime [注册时间] * @return [bool] */ public function changePwd($uid, $newPwd) { $userInfo = $this->user->getUserInfo($uid); $pwd = \Ucenter\Utils\Inputs::makeSecert($newPwd, $userInfo['u_regtime']); return $this->user->updatePwd($uid, $pwd); }
/** * 修改密码 * @param unknown $uid * @param unknown $passNew */ protected function reset($mobi, $passNew, $regtime) { return $this->usermodel->updatePwdByMobi($mobi, Inputs::makeSecert($passNew, $regtime)); }