public function setPwdAction() { if (!$this->validFlag) { echo json_encode(array('ret' => 0, 'msg' => $this->warnMsg)); } else { $user = new User(); $data = $user->getUid($this->session->get('resetMobile')); $res = $user->changePwd($data['u_id'], $this->_sanReq['passwd']); if ($res) { $this->session->remove('resetToken'); $this->session->remove('resetMobile'); echo json_encode(array('ret' => 1)); } } exit; }
/** * 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; }