本文整理汇总了PHP中get_login_cookie_hash函数的典型用法代码示例。如果您正苦于以下问题:PHP get_login_cookie_hash函数的具体用法?PHP get_login_cookie_hash怎么用?PHP get_login_cookie_hash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_login_cookie_hash函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: redirect_action
public function redirect_action()
{
if (!in_weixin() or get_setting('weixin_account_role') != 'service') {
//HTTP::redirect(base64_decode($_GET['redirect']));
}
if ($_GET['code'] and get_setting('weixin_app_id') and get_setting('weixin_app_secret')) {
if (!$_GET['thirdlogin'] || !$_GET['state']) {
H::redirect_msg('授权失败: Redirect 微信三方登录发起的来源ID错误, Code: ' . htmlspecialchars($_GET['code']));
}
$thirdlogin = $_GET['thirdlogin'];
$third_info = $this->model('openid_weixin_thirdlogin')->get_third_party_login_by_name($thirdlogin);
if (!$third_info || $_GET['state'] != $third_info['token']) {
H::redirect_msg('授权失败: Redirect 微信三方登录发起的来源ID错误, Code: ' . htmlspecialchars($_GET['code']));
}
if ($access_token = $this->model('openid_weixin_weixin')->get_sns_access_token_by_authorization_code($_GET['code'])) {
if ($access_token['errcode']) {
H::redirect_msg('授权失败: Redirect ' . $access_token['errcode'] . ' ' . $access_token['errmsg'] . ', Code: ' . htmlspecialchars($_GET['code']));
}
if ($weixin_user = $this->model('openid_weixin_weixin')->get_user_info_by_openid($access_token['openid'])) {
//已有用户
$user_info = $this->model('account')->get_user_info_by_uid($weixin_user['uid']);
HTTP::set_cookie('_user_login', get_login_cookie_hash($user_info['user_name'], $user_info['password'], $user_info['salt'], $user_info['uid'], false));
} else {
$access_user = $this->model('openid_weixin_weixin')->get_user_info_by_oauth_openid($access_token['access_token'], $access_token['openid']);
if ($access_user) {
if ($user_info = $this->model('openid_weixin_weixin')->weixin_auto_register($access_token, $access_user)) {
HTTP::set_cookie('_user_login', get_login_cookie_hash($user_info['user_name'], $user_info['password'], $user_info['salt'], $user_info['uid'], false));
} else {
H::redirect_msg('用户注册失效,请重试!, State: ' . htmlspecialchars($_GET['state']) . ', Code: ' . htmlspecialchars($_GET['code']));
}
} else {
H::redirect_msg('远程服务器忙,请稍后再试, State: ' . htmlspecialchars($_GET['state']) . ', Code: ' . htmlspecialchars($_GET['code']));
}
}
$callback_url = $third_info['url'];
$query = array();
$query['state'] = $third_info['token'];
$query['openid'] = $access_token['openid'];
$query['name'] = $third_info['name'];
$callback_url = $callback_url . '?' . http_build_query($query);
H::redirect_msg('授权成功,正在跳转...', $callback_url);
} else {
H::redirect_msg('远程服务器忙,请稍后再试, State: ' . htmlspecialchars($_GET['state']) . ', Code: ' . htmlspecialchars($_GET['code']));
}
} else {
H::redirect_msg('授权失败, 请返回重新操作, URI: ' . $_SERVER['REQUEST_URI']);
}
}
开发者ID:cutcuty,项目名称:wecenterthing,代码行数:48,代码来源:wechatauth.php
示例2: weixin_auto_register
public function weixin_auto_register($access_token, $access_user)
{
if ($user_info = $this->register_user($access_token, $access_user)) {
$this->bind_account($access_user, $access_token, $user_info['uid']);
HTTP::set_cookie('_user_login', get_login_cookie_hash($user_info['user_name'], $user_info['password'], $user_info['salt'], $user_info['uid'], null, false));
return true;
}
return false;
}
开发者ID:ddxmaaa,项目名称:wecenter-loudong,代码行数:9,代码来源:weixin.php
示例3: setcookie_login
public function setcookie_login($uid, $user_name, $password, $salt, $expire = null, $hash_password = true)
{
if (!$uid) {
return false;
}
if (!$expire) {
HTTP::set_cookie('_user_login', get_login_cookie_hash($user_name, $password, $salt, $uid, $hash_password), null, '/', null, false, true);
} else {
HTTP::set_cookie('_user_login', get_login_cookie_hash($user_name, $password, $salt, $uid, $hash_password), time() + $expire, '/', null, false, true);
}
return true;
}
开发者ID:actcms,项目名称:houziquan,代码行数:12,代码来源:account.php
示例4: bind_action
public function bind_action()
{
if (AWS_APP::session()->weibo_user) {
$weibo_user_info = AWS_APP::session()->weibo_user;
unset(AWS_APP::session()->weibo_user);
}
if ($_GET['error'] == 'access_denied') {
H::redirect_msg(AWS_APP::lang()->_t('授权失败'), '/account/login/');
}
if ($this->user_id) {
$weibo_user = $this->model('openid_weibo_oauth')->get_weibo_user_by_uid($this->user_id);
if ($weibo_user) {
H::redirect_msg(AWS_APP::lang()->_t('此账号已绑定微博账号'), '/account/login/');
}
}
$callback_url = '/account/openid/weibo/bind/';
if ($_GET['return_url']) {
$callback_url .= 'return_url-' . $_GET['return_url'];
}
if ($_GET['code']) {
if ($_GET['code'] != $weibo_user_info['authorization_code']) {
$this->model('openid_weibo_oauth')->authorization_code = $_GET['code'];
$this->model('openid_weibo_oauth')->redirect_url = $callback_url;
if (!$this->model('openid_weibo_oauth')->oauth2_login()) {
H::redirect_msg($this->model('openid_weibo_oauth')->error_msg, '/account/login/');
}
$weibo_user_info = $this->model('openid_weibo_oauth')->user_info;
}
if (!$weibo_user_info) {
H::redirect_msg(AWS_APP::lang()->_t('微博登录失败,用户信息不存在'), '/account/login/');
}
$weibo_user = $this->model('openid_weibo_oauth')->get_weibo_user_by_id($weibo_user_info['id']);
if ($this->user_id) {
if ($weibo_user) {
H::redirect_msg(AWS_APP::lang()->_t('此微博账号已被绑定'), '/account/login/');
}
$this->model('openid_weibo_oauth')->bind_account($weibo_user_info, $this->user_id);
if (!$this->model('integral')->fetch_log($this->user_id, 'BIND_OPENID')) {
$this->model('integral')->process($this->user_id, 'BIND_OPENID', round(get_setting('integral_system_config_profile') * 0.2), '绑定 OPEN ID');
}
HTTP::redirect('/account/setting/openid/');
} else {
if ($weibo_user) {
$user = $this->model('account')->get_user_info_by_uid($weibo_user['uid']);
if (!$user) {
$this->model('openid_weibo_oauth')->unbind_account($weibo_user['uid']);
H::redirect_msg(AWS_APP::lang()->_t('本地用户不存在'), '/account/login/');
}
$this->model('openid_weibo_oauth')->update_user_info($weibo_user['id'], $weibo_user_info);
if (get_setting('register_valid_type') == 'approval' and $user['group_id'] == 3) {
$redirect_url = '/account/valid_approval/';
} else {
if ($_GET['state']) {
$state = base64_url_decode($_GET['state']);
}
if (get_setting('ucenter_enabled') == 'Y') {
$redirect_url = '/account/sync_login/';
if ($state['return_url']) {
$redirect_url .= 'url-' . base64_encode($state['return_url']);
}
} else {
if ($state['return_url']) {
$redirect_url = $state['return_url'];
} else {
$redirect_url = '/';
}
}
HTTP::set_cookie('_user_login', get_login_cookie_hash($user['user_name'], $user['password'], $user['salt'], $user['uid'], false));
if (get_setting('register_valid_type') == 'email' and !$user['valid_email']) {
AWS_APP::session()->valid_email = $user['email'];
}
}
HTTP::redirect($redirect_url);
} else {
switch (get_setting('register_type')) {
case 'close':
H::redirect_msg(AWS_APP::lang()->_t('本站目前关闭注册'), '/account/login/');
break;
case 'invite':
H::redirect_msg(AWS_APP::lang()->_t('本站只能通过邀请注册'), '/account/login/');
break;
case 'weixin':
H::redirect_msg(AWS_APP::lang()->_t('本站只能通过微信注册'), '/account/login/');
break;
}
AWS_APP::session()->weibo_user = $weibo_user_info;
$this->crumb(AWS_APP::lang()->_t('完善资料'), '/account/login/');
TPL::assign('register_url', 'account/ajax/weibo/register/');
$user_name = str_replace('-', '', AWS_APP::session()->weibo_user['screen_name']);
while ($this->model('account')->check_username($user_name) || !$this->model('account')->is_valid_username($user_name) || $this->model('account')->check_username_sensitive_words($user_name)) {
$user_name = $this->model('account')->random_username();
}
TPL::assign('user_name', $user_name);
TPL::assign('sns_type', 'weibo');
TPL::import_css('css/register.css');
TPL::output('account/openid/callback');
}
}
} else {
$state = $_GET['return_url'] ? base64_url_encode(array('return_url' => base64_decode($_GET['return_url']))) : null;
//.........这里部分代码省略.........
开发者ID:egogg,项目名称:wecenter-dev,代码行数:101,代码来源:weibo.php
示例5: register_action
public function register_action()
{
if ($_GET['code'] and get_setting('weixin_app_id')) {
if (!($access_token = $this->model('openid_weixin_weixin')->get_sns_access_token_by_authorization_code($_GET['code']))) {
H::redirect_msg('远程服务器忙,请稍后再试, Code: ' . htmlspecialchars($_GET['code']));
}
if ($access_token['errcode']) {
H::redirect_msg('授权失败: Register ' . $access_token['errcode'] . ' ' . $access_token['errmsg'] . ', Code: ' . htmlspecialchars($_GET['code']));
}
if (!($access_user = $this->model('openid_weixin_weixin')->get_user_info_by_oauth_openid($access_token['access_token'], $access_token['openid']))) {
H::redirect_msg('远程服务器忙,请稍后再试, Code: get_user_info');
}
if ($access_user['errcode']) {
H::redirect_msg('获取用户信息失败: ' . $access_user['errcode'] . ' ' . $access_user['errmsg']);
}
if (!$access_user['nickname']) {
H::redirect_msg(AWS_APP::lang()->_t('获取用户信息失败'));
}
if ($weixin_user = $this->model('openid_weixin_weixin')->get_user_info_by_openid($access_token['openid'])) {
$user_info = $this->model('account')->get_user_info_by_uid($weixin_user['uid']);
HTTP::set_cookie('_user_login', get_login_cookie_hash($user_info['user_name'], $user_info['password'], $user_info['salt'], $user_info['uid'], false));
if ($_GET['redirect']) {
HTTP::redirect(base64_decode($_GET['redirect']));
}
}
if ($user_info = $this->model('openid_weixin_weixin')->weixin_auto_register($access_token, $access_user)) {
if ($_GET['redirect']) {
HTTP::redirect(base64_decode($_GET['redirect']));
} else {
H::redirect_msg(AWS_APP::lang()->_t('绑定微信成功'), '/m/');
}
} else {
H::redirect_msg(AWS_APP::lang()->_t('注册失败,请返回重新操作'));
}
} else {
H::redirect_msg('授权失败, 请返回重新操作, URI: ' . $_SERVER['REQUEST_URI']);
}
}
开发者ID:Vizards,项目名称:HeavenSpree,代码行数:38,代码来源:weixin.php
示例6: synlogin
function synlogin($get, $post)
{
if (!API_SYNLOGIN) {
return API_RETURN_FORBIDDEN;
}
header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"');
$cookietime = time() + 31536000;
$uid = intval($get['uid']);
if ($uc_info = $this->db->fetchRow("SELECT * FROM {$this->tablepre}users_ucenter WHERE uc_uid = " . $uid)) {
if ($user_info = $this->db->fetchRow("SELECT * FROM {$this->tablepre}users WHERE uid = " . $uc_info['uid'])) {
HTTP::set_cookie('_user_login', get_login_cookie_hash($user_info['user_name'], $user_info['password'], $user_info['salt'], $user_info['uid'], false), $cookietime);
}
}
}
开发者ID:saintho,项目名称:wecenter,代码行数:14,代码来源:uc.php
示例7: register_action
public function register_action()
{
if ($this->user_id) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('您已登录')));
}
switch (get_setting('register_type')) {
case 'close':
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站目前关闭注册')));
break;
case 'invite':
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过邀请注册')));
break;
case 'weixin':
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过微信注册')));
break;
}
if (!AWS_APP::session()->google_user) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('Google 账号信息不存在')));
}
if ($this->model('openid_google')->get_google_user_by_id(AWS_APP::session()->google_user['id'])) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('此 Google 账号已被绑定')));
}
if ($this->model('account')->check_email($_POST['email'])) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'email'), -1, AWS_APP::lang()->_t('E-Mail 已经被使用, 或格式不正确')));
}
if (strlen($_POST['password']) < 6 or strlen($_POST['password']) > 16) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'userPassword'), -1, AWS_APP::lang()->_t('密码长度不符合规则')));
}
if (!$_POST['agreement_chk']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你必需同意用户协议才能继续')));
}
if (get_setting('ucenter_enabled') == 'Y') {
$result = $this->model('ucenter')->register($_POST['user_name'], $_POST['password'], $_POST['email']);
if (!is_array($result)) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('UCenter 同步失败,错误为:%s', $result)));
}
$uid = $result['user_info']['uid'];
$redirect_url = '/account/sync_login/';
} else {
$uid = $this->model('account')->user_register($_POST['user_name'], $_POST['password'], $_POST['email']);
if (get_setting('register_valid_type') != 'approval') {
$this->model('active')->active_user_by_uid($uid);
}
if (AWS_APP::session()->google_user['email'] == $_POST['email'] and AWS_APP::session()->google_user['verified_email'] == true) {
$this->model('active')->set_user_email_valid_by_uid($uid);
} else {
if (get_setting('register_valid_type') == 'email') {
$this->model('active')->new_valid_email($uid);
}
}
$redirect_url = '/';
}
if (!$uid) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('注册失败')));
}
$this->model('openid_google')->bind_account(AWS_APP::session()->google_user, $uid);
if (AWS_APP::session()->google_user['picture']) {
$this->model('account')->associate_remote_avatar($uid, AWS_APP::session()->google_user['picture']);
}
if (get_setting('register_valid_type') == 'approval') {
$redirect_url = '/account/valid_approval/';
} else {
$user_info = $this->model('account')->get_user_info_by_uid($uid);
HTTP::set_cookie('_user_login', get_login_cookie_hash($user_info['user_name'], $user_info['password'], $user_info['salt'], $user_info['uid'], false));
if (get_setting('register_valid_type') == 'email') {
AWS_APP::session()->valid_email = $user_info['email'];
}
}
unset(AWS_APP::session()->google_user);
H::ajax_json_output(AWS_APP::RSM(array('url' => get_js_url($redirect_url)), 1, null));
}
开发者ID:egogg,项目名称:wecenter-dev,代码行数:71,代码来源:google.php
示例8: bind_action
public function bind_action()
{
if (AWS_APP::session()->twitter_request_token) {
$twitter_request_token = AWS_APP::session()->twitter_request_token;
unset(AWS_APP::session()->twitter_request_token);
}
if (AWS_APP::session()->twitter_user) {
$twitter_user_info = AWS_APP::session()->twitter_user;
unset(AWS_APP::session()->twitter_user);
}
if ($_GET['denied']) {
H::redirect_msg(AWS_APP::lang()->_t('授权失败'), '/account/login/');
}
if ($this->user_id) {
$twitter_user = $this->model('openid_twitter')->get_twitter_user_by_uid($this->user_id);
if ($twitter_user) {
H::redirect_msg(AWS_APP::lang()->_t('此账号已绑定 Twitter 账号'), '/account/login/');
}
}
if ($_GET['oauth_token']) {
if (!$twitter_user_info) {
if ($_GET['oauth_token'] != $twitter_request_token['oauth_token']) {
H::redirect_msg(AWS_APP::lang()->_t('oauth token 不一致'), '/account/login/');
}
if (!$_GET['oauth_verifier']) {
H::redirect_msg(AWS_APP::lang()->_t('oauth verifier 为空'), '/account/login/');
}
$this->model('openid_twitter')->request_token = $twitter_request_token;
$this->model('openid_twitter')->request_token['oauth_verifier'] = $_GET['oauth_verifier'];
if (!$this->model('openid_twitter')->get_user_info()) {
H::redirect_msg($this->model('openid_twitter')->error_msg, '/account/login/');
}
$twitter_user_info = $this->model('openid_twitter')->user_info;
}
if (!$twitter_user_info) {
H::redirect_msg(AWS_APP::lang()->_t('Twitter 登录失败,用户信息不存在'), '/account/login/');
}
$twitter_user = $this->model('openid_twitter')->get_twitter_user_by_id($twitter_user_info['id']);
if ($this->user_id) {
if ($twitter_user) {
H::redirect_msg(AWS_APP::lang()->_t('此 Twitter 账号已被绑定'), '/account/login/');
}
$this->model('openid_twitter')->bind_account($twitter_user_info, $this->user_id);
if (!$this->model('integral')->fetch_log($this->user_id, 'BIND_OPENID')) {
$this->model('integral')->process($this->user_id, 'BIND_OPENID', round(get_setting('integral_system_config_profile') * 0.2), '绑定 OPEN ID');
}
HTTP::redirect('/account/setting/openid/');
} else {
if ($twitter_user) {
$user = $this->model('account')->get_user_info_by_uid($twitter_user['uid']);
if (!$user) {
$this->model('openid_twitter')->unbind_account($twitter_user['uid']);
H::redirect_msg(AWS_APP::lang()->_t('本地用户不存在'), '/account/login/');
}
$this->model('openid_twitter')->update_user_info($twitter_user['id'], $twitter_user_info);
if (get_setting('register_valid_type') == 'approval' and $user['group_id'] == 3) {
$redirect_url = '/account/valid_approval/';
} else {
if (get_setting('ucenter_enabled') == 'Y') {
$redirect_url = '/account/sync_login/';
if ($_GET['return_url']) {
$redirect_url .= 'url-' . $_GET['return_url'];
}
} else {
if ($state['return_url']) {
$redirect_url = $state['return_url'];
} else {
$redirect_url = '/';
}
}
HTTP::set_cookie('_user_login', get_login_cookie_hash($user['user_name'], $user['password'], $user['salt'], $user['uid'], false));
if (get_setting('register_valid_type') == 'email' and !$user['valid_email']) {
AWS_APP::session()->valid_email = $user['email'];
}
}
HTTP::redirect($redirect_url);
} else {
switch (get_setting('register_type')) {
case 'close':
H::redirect_msg(AWS_APP::lang()->_t('本站目前关闭注册'), '/account/login/');
break;
case 'invite':
H::redirect_msg(AWS_APP::lang()->_t('本站只能通过邀请注册'), '/account/login/');
break;
case 'weixin':
H::redirect_msg(AWS_APP::lang()->_t('本站只能通过微信注册'), '/account/login/');
break;
}
AWS_APP::session()->twitter_user = $twitter_user_info;
$this->crumb(AWS_APP::lang()->_t('完善资料'), '/account/login/');
TPL::assign('register_url', '/account/ajax/twitter/register/');
TPL::assign('user_name', AWS_APP::session()->twitter_user['name']);
TPL::import_css('css/register.css');
TPL::output('account/openid/callback');
}
}
} else {
$this->model('openid_twitter')->oauth_callback = '/account/openid/twitter/bind/';
if ($_GET['return_url']) {
$this->model('openid_twitter')->oauth_callback .= 'return_url-' . $_GET['return_url'];
//.........这里部分代码省略.........
开发者ID:Vizards,项目名称:HeavenSpree,代码行数:101,代码来源:twitter.php
示例9: qq_login_callback_action
public function qq_login_callback_action()
{
if ($this->is_post() and AWS_APP::session()->qq_profile and AWS_APP::session()->QQConnect) {
if (get_setting('register_type') == 'close') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站目前关闭注册')));
} else {
if (get_setting('register_type') == 'invite') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过邀请注册')));
} else {
if (get_setting('register_type') == 'weixin') {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('本站只能通过微信注册')));
}
}
}
if (trim($_POST['user_name']) == '') {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'user_name'), -1, AWS_APP::lang()->_t('请输入真实姓名')));
} else {
if ($this->model('account')->check_username($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'user_name'), -1, AWS_APP::lang()->_t('真实姓名已经存在')));
} else {
if ($check_rs = $this->model('account')->check_username_char($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'user_name'), -1, $check_rs));
} else {
if ($this->model('account')->check_username_sensitive_words($_POST['user_name'])) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'user_name'), -1, AWS_APP::lang()->_t('真实姓名中包含敏感词或系统保留字')));
}
}
}
}
if ($this->model('account')->check_email($_POST['email'])) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'email'), -1, AWS_APP::lang()->_t('E-Mail 已经被使用, 或格式不正确')));
}
if (strlen($_POST['password']) < 6 or strlen($_POST['password']) > 16) {
H::ajax_json_output(AWS_APP::RSM(array('input' => 'userPassword'), -1, AWS_APP::lang()->_t('密码长度不符合规则')));
}
if (!$_POST['agreement_chk']) {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('你必需同意用户协议才能继续')));
}
if (get_setting('ucenter_enabled') == 'Y') {
$result = $this->model('ucenter')->register($_POST['user_name'], $_POST['password'], $_POST['email'], true);
if (is_array($result)) {
$uid = $result['user_info']['uid'];
} else {
H::ajax_json_output(AWS_APP::RSM(null, -1, $result));
}
} else {
$uid = $this->model('account')->user_register($_POST['user_name'], $_POST['password'], $_POST['email']);
if (get_setting('register_valid_type') == 'email') {
$this->model('active')->new_valid_email($uid);
}
if (get_setting('register_valid_type') != 'approval') {
$this->model('active')->active_user_by_uid($uid);
}
}
if ($uid) {
$this->model('openid_qq')->bind_account(AWS_APP::session()->qq_profile, null, $uid, true);
if (AWS_APP::session()->qq_profile['figureurl_2']) {
$this->model('account')->associate_remote_avatar($uid, AWS_APP::session()->qq_profile['figureurl_2']);
}
H::ajax_json_output(AWS_APP::RSM(null, 1, null));
} else {
H::ajax_json_output(AWS_APP::RSM(null, -1, AWS_APP::lang()->_t('与 QQ 通信出错 (Register), 请重新登录')));
}
} else {
if (!$_GET['code']) {
H::redirect_msg(AWS_APP::lang()->_t('与 QQ 通信出错, 请重新登录'), "/account/login/");
}
if (!AWS_APP::session()->QQConnect['access_token']) {
if (!$this->model('openid_qq')->request_access_token(get_js_url('/account/openid/qq_login_callback/'))) {
H::redirect_msg(AWS_APP::lang()->_t('与 QQ 通信出错, 请重新登录'), "/account/login/");
}
}
if (!AWS_APP::session()->QQConnect['access_token'] or !($uinfo = $this->model('openid_qq')->request_user_info())) {
H::redirect_msg(AWS_APP::lang()->_t('与 QQ 通信出错, 请重新登录'), "/account/login/");
}
AWS_APP::session()->qq_profile = $uinfo;
if ($qq_user = $this->model('openid_qq')->get_user_info_by_open_id(load_class('Services_Tencent_QQConnect_V2')->get_openid())) {
$user_info = $this->model('account')->get_user_info_by_uid($qq_user['uid']);
HTTP::set_cookie('_user_login', get_login_cookie_hash($user_info['user_name'], $user_info['password'], $user_info['salt'], $user_info['uid'], false));
$this->model('openid_qq')->update_token($qq_user['name'], AWS_APP::session()->QQConnect['access_token']);
HTTP::redirect('/');
} else {
if ($this->user_id) {
$this->model('openid_qq')->bind_account($this->model('openid_qq')->request_user_info(), '/', $this->user_id);
} else {
if (get_setting('register_type') == 'close') {
H::redirect_msg(AWS_APP::lang()->_t('本站目前关闭注册'));
} else {
if (get_setting('register_type') == 'invite') {
H::redirect_msg(AWS_APP::lang()->_t('本站只能通过邀请注册'));
} else {
$this->crumb(AWS_APP::lang()->_t('完善资料'), '/account/login/');
TPL::assign('user_name', str_replace(' ', '_', AWS_APP::session()->qq_profile['nickname']));
TPL::import_css('css/register.css');
TPL::output('account/openid/callback');
}
}
}
}
}
//.........这里部分代码省略.........
开发者ID:chenruixuan,项目名称:wecenter,代码行数:101,代码来源:openid.php
注:本文中的get_login_cookie_hash函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论