public function login() { $aUsername = $username = I('username', '', 'op_t'); $aPassword = I('password', '', 'op_t'); $aVerify = I('verify', '', 'op_t'); $aRemember = I('remember', 0, 'intval'); // 检测验证码 if (check_verify_open('login')) { if (!check_verify($aVerify)) { $res['info'] = "验证码输入错误。"; return $res; } } // 调用UC登录接口登录 check_username($aUsername, $email, $mobile, $aUnType); if (!check_reg_type($aUnType)) { $res['info'] = "该类型未开放登录。"; } $uid = UCenterMember()->login($username, $aPassword, $aUnType); if (0 < $uid) { //UC登录成功 // 登录用户 $Member = D('Member'); $args['uid'] = $uid; $args = array('uid' => $uid, 'nickname' => $username); check_and_add($args); if ($Member->mobileLogin($uid, $aRemember) == 1) { //登录用户 if (UC_SYNC && $uid != 1) { //同步登录到UC $ref = M('ucenter_user_link')->where(array('uid' => $uid))->find(); } $extra = array(); $extra['session_id'] = session_id(); $extra['uid'] = $uid; C(api('Config/lists')); $extra['weibo_words_limit'] = C('WEIBO_WORDS_COUNT'); $extra['version'] = C('APP_VERSION'); $extra['self'] = query_user(array('uid', 'nickname', 'avatar128', 'avatar256'), is_login()); $this->apiSuccess("登录成功", $extra); } else { $this->apiError('登陆成功'); } } else { //登录失败 switch ($uid) { case -1: $res['info'] = '用户不存在或被禁用!'; break; //系统级别禁用 //系统级别禁用 case -2: $res['info'] = '密码错误!'; break; default: $res['info'] = $uid; break; // 0-接口参数错误(调试阶段使用) } } dump(1111); $this->apiError($res['info']); }
public function doLogin() { $aUsername = $username = I('post.username', '', 'op_t'); $aPassword = I('post.password', '', 'op_t'); $aVerify = I('post.verify', '', 'op_t'); $aRemember = I('post.remember', 0, 'intval'); /* 检测验证码 */ if (check_verify_open('login')) { if (!check_verify($aVerify)) { $res['info'] = "验证码输入错误。"; return $res; } } /* 调用UC登录接口登录 */ check_username($aUsername, $email, $mobile, $aUnType); if (!check_reg_type($aUnType)) { $res['info'] = "该类型未开放登录。"; } $uid = UCenterMember()->login($username, $aPassword, $aUnType); if (0 < $uid) { //UC登录成功 /* 登录用户 */ $Member = D('Member'); $args['uid'] = $uid; $args = array('uid' => $uid, 'nickname' => $username); check_and_add($args); if ($Member->login($uid, $aRemember == 1)) { //登录用户 //TODO:跳转到登录前页面 if (UC_SYNC && $uid != 1) { //同步登录到UC $ref = M('ucenter_user_link')->where(array('uid' => $uid))->find(); $html = ''; $html = uc_user_synlogin($ref['uc_uid']); } $oc_config = (include_once './OcApi/oc_config.php'); if ($oc_config['SSO_SWITCH']) { include_once './OcApi/OCenter/OCenter.php'; $OCApi = new \OCApi(); $html = $OCApi->ocSynLogin($uid); } $res['status'] = 1; $res['info'] = $html; //$this->success($html, get_nav_url(C('AFTER_LOGIN_JUMP_URL'))); } else { $res['info'] = $Member->getError(); } } else { //登录失败 switch ($uid) { case -1: $res['info'] = '用户不存在或被禁用!'; break; //系统级别禁用 //系统级别禁用 case -2: $res['info'] = '密码错误!'; break; default: $res['info'] = $uid; break; // 0-接口参数错误(调试阶段使用) } } return $res; }
public function doLogin() { $aUsername = $username = I('post.username', '', 'op_t'); $aPassword = I('post.password', '', 'op_t'); $aVerify = I('post.verify', '', 'op_t'); $aRemember = I('post.remember', 0, 'intval'); /* 检测验证码 */ if (check_verify_open('login')) { if (!check_verify($aVerify)) { $res['info'] = L('_INFO_VERIFY_CODE_INPUT_ERROR_') . L('_PERIOD_'); return $res; } } /* 调用UC登录接口登录 */ check_username($aUsername, $email, $mobile, $aUnType); if (!check_reg_type($aUnType)) { $res['info'] = L('_INFO_TYPE_NOT_OPENED_') . L('_PERIOD_'); } $uid = UCenterMember()->login($username, $aPassword, $aUnType); if (0 < $uid) { //UC登录成功 /* 登录用户 */ $Member = D('Member'); $args['uid'] = $uid; $args = array('uid' => $uid, 'nickname' => $username); check_and_add($args); if ($Member->login($uid, $aRemember == 1)) { //登录用户 //TODO:跳转到登录前页面 $html_uc = ''; if (UC_SYNC && $uid != 1) { include_once './api/uc_client/client.php'; //同步登录到UC $ref = M('ucenter_user_link')->where(array('uid' => $uid))->find(); $html_uc = uc_user_synlogin($ref['uc_uid']); } $oc_config = (include_once './OcApi/oc_config.php'); if ($oc_config['SSO_SWITCH']) { include_once './OcApi/OCenter/OCenter.php'; $OCApi = new \OCApi(); $html_oc = $OCApi->ocSynLogin($uid); } $html = empty($html_oc) ? $html_uc : $html_oc; $res['status'] = 1; $res['info'] = $html; //$this->success($html, get_nav_url(C('AFTER_LOGIN_JUMP_URL'))); } else { $res['info'] = $Member->getError(); } } else { //登录失败 switch ($uid) { case -1: $res['info'] = L('_INFO_USER_FORBIDDEN_'); break; //系统级别禁用 //系统级别禁用 case -2: $res['info'] = L('_INFO_PW_ERROR_') . L('_EXCLAMATION_'); break; default: $res['info'] = $uid; break; // 0-接口参数错误(调试阶段使用) } } return $res; }