Exemplo n.º 1
0
 /**
  * 一键登录
  */
 public function oauthAction()
 {
     $oauthname = $this->get('name');
     if ($this->memberconfig['isoauth'] && $oauthname) {
         $config = $this->loadOauth($oauthname);
         oauth_login($config);
     } else {
         $this->memberMsg(lang('m-log-10'), url('member/login'));
     }
 }
Exemplo n.º 2
0
    $oauth_info = $_SESSION['oauth_info'];
    unset($_SESSION['oauth_info']);
    if (!$oauth_info) {
        trigger_error("Extern auth error!");
    }
    $oauth_info->name = $_POST['USERNAME'];
    if (strlen($oauth_info->name) <= 3) {
        oauth_show_register($oauth_info, false, true);
    }
    $username_clean = utf8_clean_string($oauth_info->name);
    $sql = 'SELECT * FROM ' . USERS_TABLE . ' WHERE username_clean = "' . $username_clean . '"';
    $result = $db->sql_query($sql);
    $row = $db->sql_fetchrow($result);
    $db->sql_freeresult($result);
    if ($row) {
        oauth_show_register($oauth_info, true);
    }
    $row = oauth_new_user_row($oauth_info);
    if (!function_exists('user_add')) {
        include $phpbb_root_path . 'includes/functions_user.' . $phpEx;
    }
    $id = user_add($row);
    $sql = 'UPDATE ' . USERS_TABLE . ' SET oauth_method = "' . $oauth_info->oauth_method . '", oauth_id = "' . $oauth_info->id . '", oauth_token="' . $oauth_info->access_token . '" WHERE user_id = ' . $id;
    $db->sql_query($sql);
    redirect("./ucp." . $phpEx . "?mode=login");
}
if ($_REQUEST['mode'] == 'register') {
    oauth_register();
} else {
    oauth_login();
}