|
@@ -27,18 +27,18 @@ class loginControl extends mobileHomeControl
|
|
|
return joutput_error(errcode::ErrApptype);
|
|
|
}
|
|
|
|
|
|
- $type = trim($_POST['type']);
|
|
|
- if(empty($type) || !in_array($type, $this->client_login_type_array)) {
|
|
|
+ $type = trim($_POST['type']);
|
|
|
+ if(!isset($type) || !in_array($type, $this->client_login_type_array)) {
|
|
|
return joutput_error(errcode::ErrParamter,'type error.');
|
|
|
}
|
|
|
|
|
|
$validate = new Validate();
|
|
|
|
|
|
- $openid = trim($_POST['openid']);
|
|
|
- if($type == memberModel::mobile_login) {
|
|
|
+ if($type == memberModel::mobile_login) {
|
|
|
+ $openid = trim($_POST['mobile']);
|
|
|
$password = trim($_POST['password']);
|
|
|
$validate->setValidate(Validate::verify_mobile($openid));
|
|
|
- $validate->setValidate(Validate::verify_password($password));
|
|
|
+ $validate->setValidate(Validate::verify_password($password));
|
|
|
} else {
|
|
|
$openid = trim($_POST['openid']);
|
|
|
$validate->setValidate(Validate::verify_openid($openid));
|
|
@@ -80,7 +80,7 @@ class loginControl extends mobileHomeControl
|
|
|
}
|
|
|
|
|
|
$type = $_POST['type'];
|
|
|
- if(empty($type) || !in_array($type, $this->client_login_type_array)) {
|
|
|
+ if(!isset($type) || !in_array($type, $this->client_login_type_array)) {
|
|
|
return joutput_error(errcode::ErrParamter,'type error.');
|
|
|
}
|
|
|
|
|
@@ -139,7 +139,7 @@ class loginControl extends mobileHomeControl
|
|
|
static $bind_types = array('mobile','wx');
|
|
|
|
|
|
$type = trim($_POST['type']);
|
|
|
- if(empty($type) || !in_array($type, $bind_types)) {
|
|
|
+ if(!isset($type) || !in_array($type, $bind_types)) {
|
|
|
return joutput_error(errcode::ErrParamter,'Bind type error,only support mobile and wx.');
|
|
|
}
|
|
|
|
|
@@ -288,7 +288,7 @@ class loginControl extends mobileHomeControl
|
|
|
|
|
|
$validator = new Validate();
|
|
|
|
|
|
- $code = $trim($_POST['code']);
|
|
|
+ $code = trim($_POST['code']);
|
|
|
$validator->setValidate(Validate::smscode($code));
|
|
|
$err = $validator->validate();
|
|
|
if($err != '') {
|
|
@@ -297,10 +297,12 @@ class loginControl extends mobileHomeControl
|
|
|
|
|
|
$key = $this->gen_token_code($token);
|
|
|
$ret = rcache($key,'member');
|
|
|
- if(!empty($ret) && $ret['code'] == $code) {
|
|
|
+ if(empty($ret)) {
|
|
|
+ joutput_error(errcode::ErrSmscodeExpire);
|
|
|
+ } elseif ($ret['code'] == $code) {
|
|
|
joutput_data(NULL);
|
|
|
} else {
|
|
|
- joutput_error(errcode::ErrSmscodeExpire);
|
|
|
+ joutput_error(errcode::ErrSmscode);
|
|
|
}
|
|
|
}
|
|
|
|