|
@@ -257,7 +257,7 @@ class loginControl extends mobileHomeControl
|
|
{
|
|
{
|
|
$success = $model->insert(array('member_mobile' => $mobile,'member_type' => 0,'member_passwd' => md5($password)));
|
|
$success = $model->insert(array('member_mobile' => $mobile,'member_type' => 0,'member_passwd' => md5($password)));
|
|
if($success) {
|
|
if($success) {
|
|
- return joutput_data(array());
|
|
|
|
|
|
+ return joutput_data(NULL);
|
|
} else {
|
|
} else {
|
|
return joutput_error(errcode::ErrDB,"DB error.");
|
|
return joutput_error(errcode::ErrDB,"DB error.");
|
|
}
|
|
}
|
|
@@ -317,7 +317,7 @@ class loginControl extends mobileHomeControl
|
|
if ($result) {
|
|
if ($result) {
|
|
return $token;
|
|
return $token;
|
|
} else {
|
|
} else {
|
|
- return null;
|
|
|
|
|
|
+ return NULL;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -337,19 +337,8 @@ class loginControl extends mobileHomeControl
|
|
{
|
|
{
|
|
$mobile = trim($_POST['mobile']);
|
|
$mobile = trim($_POST['mobile']);
|
|
|
|
|
|
- $token = trim($_POST['token']);
|
|
|
|
- if (empty($token)) {
|
|
|
|
- return joutput_error(errcode::ErrParamter, 'Token cannot empty.');
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- $userid = token_uid($token);
|
|
|
|
- if ($userid == -1) {
|
|
|
|
- return joutput_error(errcode::ErrTokenExpire);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
$validator = new Validate();
|
|
$validator = new Validate();
|
|
$validator->setValidate(Validate::verify_mobile($mobile));
|
|
$validator->setValidate(Validate::verify_mobile($mobile));
|
|
-
|
|
|
|
$err = $validator->validate();
|
|
$err = $validator->validate();
|
|
if ($err != '') {
|
|
if ($err != '') {
|
|
return joutput_error(errcode::ErrParamter, $err);
|
|
return joutput_error(errcode::ErrParamter, $err);
|
|
@@ -357,10 +346,10 @@ class loginControl extends mobileHomeControl
|
|
|
|
|
|
$sms = new Sms();
|
|
$sms = new Sms();
|
|
$code = makeSmscode();
|
|
$code = makeSmscode();
|
|
-
|
|
|
|
$status = $sms->send($mobile, array('code' => $code, 'type' => Sms::register_code, 'time' => '5'));
|
|
$status = $sms->send($mobile, array('code' => $code, 'type' => Sms::register_code, 'time' => '5'));
|
|
|
|
+
|
|
if ($status == 0) {
|
|
if ($status == 0) {
|
|
- $key = $this->gen_token_code($token);
|
|
|
|
|
|
+ $key = $this->gen_mobile_code($mobile);
|
|
wcache($key, array('code' => $code, 'mobile' => $mobile), 'member', self::code_expire);
|
|
wcache($key, array('code' => $code, 'mobile' => $mobile), 'member', self::code_expire);
|
|
joutput_data(NULL);
|
|
joutput_data(NULL);
|
|
} else {
|
|
} else {
|