Example #1
0
         draw($tool_content, 0);
         exit;
     } else {
         // try to authenticate user
         $auth_method_settings = get_auth_settings($auth);
         if ($auth == 6) {
             redirect_to_home_page('secure/index_reg.php' . ($prof ? '?p=1' : ''));
         }
         $is_valid = auth_user_login($auth, $uname, $passwd, $auth_method_settings);
     }
     if ($auth == 7) {
         if (phpCAS::checkAuthentication()) {
             $uname = phpCAS::getUser();
             $cas = get_auth_settings($auth);
             // store CAS released attributes in $GLOBALS['auth_user_info']
             get_cas_attrs(phpCAS::getAttributes(), $cas);
             if (!empty($uname)) {
                 $is_valid = true;
             }
         }
     }
 }
 if ($is_valid) {
     // connection successful
     $_SESSION['was_validated'] = array('auth' => $auth, 'uname' => $uname, 'uname_exists' => user_exists($uname));
     if (isset($GLOBALS['auth_user_info'])) {
         $_SESSION['was_validated']['auth_user_info'] = $GLOBALS['auth_user_info'];
     }
 } else {
     $tool_content .= "<div class='alert alert-danger'>{$langConnNo}<br>{$langAuthNoValidUser}</div>" . "<p>&laquo; <a href='{$lastpage}'>{$langBack}</a></p>";
 }
Example #2
0

/*
 *  	Authors:	Giannis Kapetanakis <*****@*****.**>
 */

require_once '../../include/baseTheme.php';
require_once 'include/CAS/CAS.php';
require_once 'modules/auth/auth.inc.php';

$auth = 7;
cas_authenticate($auth);
if (phpCAS::checkAuthentication()) {
    $cas = get_auth_settings($auth);
    $_SESSION['cas_attributes'] = phpCAS::getAttributes();
    $attrs = get_cas_attrs($_SESSION['cas_attributes'], $cas);
    $_SESSION['cas_uname'] = phpCAS::getUser();

    if (!empty($_SESSION['cas_uname'])) {
        $_SESSION['uname'] = $_SESSION['cas_uname'];
    }
    if (!empty($attrs['casuserlastattr'])) {
        $_SESSION['cas_surname'] = $attrs['casuserlastattr'];
    }
    if (!empty($attrs['casuserfirstattr'])) {
        $_SESSION['cas_givenname'] = $attrs['casuserfirstattr'];
    }
    if (!empty($attrs['casusermailattr'])) {
        $_SESSION['cas_email'] = $attrs['casusermailattr'];
    }
    if (!empty($attrs['casuserstudentid'])) {