public function login($dbConnection = null)
 {
     global $facebook;
     global $session;
     $facebookID = null;
     $loggedIn = false;
     try {
         $facebookID = $facebook->getUser();
         if ($facebookID != null) {
             if ($dbConnection == null) {
                 $dbConnection = DatabaseUtilities::getDatabaseConnection();
             }
             $sessionKey = SessionDao::generateSGUID($facebookID, $dbConnection);
             //If sguid is null, attempt to create users account.
             if ($sessionKey == null) {
                 //If member account is successfully created, attemp to generate a GUID.
                 if (LoginController::createMemberAccount($facebookID, $facebook)) {
                     //Account should have been created, get SGUID.
                     $sessionKey = SessionDao::generateSGUID($facebookID, $dbConnection);
                 }
             }
             //If session key has been created, add to session
             if ($sessionKey != null) {
                 //Refresh any old sessions.
                 if (SessionDao::updateSession($facebookID, $sessionKey, $dbConnection)) {
                     $_SESSION[LoginController::SESSION_ID] = $sessionKey;
                     $loggedIn = true;
                 }
             }
         } else {
             //User has not authenticated with Facebook.
         }
     } catch (Exception $ex) {
         echo "Exception: " . $ex->getMessage();
         $loggedIn = false;
     }
     return $loggedIn;
 }
Exemple #2
0
        $user_name_search = "";
        $result = $dao->listAllUsers(0, $offset, $limit, $sort_params['sort_header'], $sort_params['order'], $status_values);
    }
} else {
    $result = $dao->listAllUsersForGroup($group_id, $offset, $limit);
}
/*
 * Show list of users
 */
$HTML->header(array('title' => $Language->getText('admin_userlist', 'title')));
echo "<p>";
echo $Language->getText('admin_userlist', 'user_list') . ":  ";
if (!$group_id) {
    echo "<strong>" . $Language->getText('admin_userlist', 'all_groups') . "</strong>";
    echo '</p>';
    $session_dao = new SessionDao();
    echo '<p>';
    echo '<form action="/admin/sessions.php" method="post">';
    $csrf = new CSRFSynchronizerToken('/admin/sessions.php');
    echo $csrf->fetchHTMLInput();
    echo $Language->getText('admin_userlist', 'active_sessions', $session_dao->count());
    echo '</form>';
} else {
    $pm = ProjectManager::instance();
    echo "<strong>" . $Language->getText('admin_userlist', 'group', array($pm->getProject($group_id)->getPublicName())) . "</strong>";
}
/*
 * Add search field
 */
$hp = Codendi_HTMLPurifier::instance();
$user_name_search_purify = $hp->purify($user_name_search);
Exemple #3
0
/*
 * Copyright (c) Enalean, 2011. All Rights Reserved.
 *
 * This file is a part of Tuleap.
 *
 * Tuleap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Tuleap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tuleap. If not, see <http://www.gnu.org/licenses/>.
 */
require_once 'pre.php';
require_once 'common/dao/SessionDao.class.php';
require_once 'common/include/CSRFSynchronizerToken.class.php';
session_require(array('group' => '1', 'admin_flags' => 'A'));
$request = HTTPRequest::instance();
if ($request->exist('reset_all_sessions')) {
    $csrf = new CSRFSynchronizerToken('/admin/sessions.php');
    $csrf->check('/admin/userlist.php');
    $session_dao = new SessionDao();
    $session_dao->deleteAll();
}
$GLOBALS['HTML']->redirect('/');