예제 #1
0
파일: session.php 프로젝트: lorea/Hydra-dev
function init()
{
    global $CFG;
    if (elgg_is_logged_in()) {
        setLoggedInUser(normaliseUsername($_SESSION['user']->username));
    } else {
        setLoggedInUser(null);
    }
}
예제 #2
0
/**
 * Log in a user and potentially continue the requested identity approval
 */
function action_login()
{
    $method = $_SERVER['REQUEST_METHOD'];
    switch ($method) {
        case 'GET':
            return login_render();
        case 'POST':
            $info = getRequestInfo();
            $fields = $_POST;
            if (isset($fields['cancel'])) {
                return authCancel($info);
            }
            list($errors, $openid_url) = login_checkInput($fields);
            if (count($errors) || !$openid_url) {
                $needed = $info ? $info->identity : false;
                return login_render($errors, @$fields['openid_url'], $needed);
            } else {
                setLoggedInUser($openid_url);
                return doAuth($info);
            }
        default:
            return login_render(array('Unsupported HTTP method: $method'));
    }
}