|
|
|
@ -338,7 +338,9 @@ class UserController extends BaseController
|
|
|
|
|
$password = $safeinfo['password'];
|
|
|
|
|
$sex = $safeinfo['sex'];
|
|
|
|
|
|
|
|
|
|
$this->checksafecode($phone, $safecode, false);
|
|
|
|
|
if (!$this->checksafecode($phone, $safecode)) {
|
|
|
|
|
return $this->ajaxReturn(array('status' => 0, 'msg' => '验证失败'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**是否开启ucenter**/
|
|
|
|
@ -613,22 +615,17 @@ class UserController extends BaseController
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 手机安全码验证
|
|
|
|
|
* @param bool $flag true 用于直接异步请求 false 用于方法调用
|
|
|
|
|
* @param [type] $vcode [description]
|
|
|
|
|
*/
|
|
|
|
|
public function checksafecode($phone, $vcode, $flag = true)
|
|
|
|
|
public function checksafecode($phone, $code)
|
|
|
|
|
{
|
|
|
|
|
$taskClient = new TaskClient();
|
|
|
|
|
$result = $taskClient->checkSms($phone, $vcode);
|
|
|
|
|
$result = $taskClient->checkSms($phone, $code);
|
|
|
|
|
$data = [];
|
|
|
|
|
if ($result['code'] == TaskClient::SUCCESS) {
|
|
|
|
|
$data['status'] = 1;
|
|
|
|
|
if ($result && $result['code'] == TaskClient::SUCCESS) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
$data['status'] = 0;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
$data['msg'] = $result['message'];
|
|
|
|
|
echo json_encode($data);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -641,8 +638,11 @@ class UserController extends BaseController
|
|
|
|
|
if (IS_POST) {
|
|
|
|
|
|
|
|
|
|
$phone = $_POST['phone'];
|
|
|
|
|
$code = $_REQUEST['code'];
|
|
|
|
|
|
|
|
|
|
$this->checksafecode($phone, $_REQUEST['code'], false);
|
|
|
|
|
if (!$this->checksafecode($phone, $code)) {
|
|
|
|
|
return $this->ajaxReturn(array('status' => 0, 'msg' => '验证失败'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->success('验证成功', U('User/forget1', array('phone' => $phone)));
|
|
|
|
|
|
|
|
|
@ -658,8 +658,11 @@ class UserController extends BaseController
|
|
|
|
|
if (IS_POST) {
|
|
|
|
|
$new_pwd = $_REQUEST['new_pwd'];
|
|
|
|
|
$u_uid['phone'] = $_REQUEST['phone'];
|
|
|
|
|
$code = $_REQUEST['code'];
|
|
|
|
|
//验证短信验证码
|
|
|
|
|
$this->checksafecode($u_uid['phone'], $_REQUEST['code'], false);
|
|
|
|
|
if (!$this->checksafecode($u_uid['phone'], $code)) {
|
|
|
|
|
$this->error("验证失败");
|
|
|
|
|
}
|
|
|
|
|
$result = M('user', 'tab_')->where($u_uid)->setField('password', think_ucenter_md5($new_pwd, UC_AUTH_KEY));
|
|
|
|
|
if ($result != false) {
|
|
|
|
|
$this->success("修改成功", U('User/login'));
|
|
|
|
@ -875,7 +878,10 @@ class UserController extends BaseController
|
|
|
|
|
if (IS_POST) {
|
|
|
|
|
$code = I("post.scode");
|
|
|
|
|
$phone = I("post.phone");
|
|
|
|
|
$this->checksafecode($phone, $code, false);
|
|
|
|
|
if (!$this->checksafecode($phone, $code)) {
|
|
|
|
|
echo json_encode(array('status' => 0, 'msg' => '验证失败'));
|
|
|
|
|
exit();
|
|
|
|
|
}
|
|
|
|
|
if (!$user['phone']) {
|
|
|
|
|
$where['account'] = $phone;
|
|
|
|
|
$where['phone'] = $phone;
|
|
|
|
|