Changeset 1135

Show
Ignore:
Timestamp:
11/23/06 10:11:15 (7 years ago)
Author:
benoitg
Message:

* Fix broken auth

Location:
trunk/wifidog-auth
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1133 r1135  
     12006-11-22 Benoit Grégoire  <bock@step.polymtl.ca> 
     2        * Fix broken auth 
    132006-11-22 Benoit Grégoire  <bock@step.polymtl.ca> 
    24        * Major schema update (this one is going to make your database grind for a while, sorry 
  • trunk/wifidog-auth/wifidog/classes/User.php

    r1128 r1135  
    446446                $node_ip = $db->escapeString($_SERVER['REMOTE_ADDR']); 
    447447            } 
    448  
    449             if ($session && $node_ip && $session->get(SESS_GW_ID_VAR)) { 
    450                 $node_id = $db->escapeString($session->get(SESS_GW_ID_VAR)); 
     448            if ($session && $node_ip && $session->get(SESS_NODE_ID_VAR)) { 
     449                //echo "$session && $node_ip && {$session->get(SESS_NODE_ID_VAR)}"; 
     450                $node_id = $db->escapeString($session->get(SESS_NODE_ID_VAR)); 
    451451                $db->execSqlUpdate("INSERT INTO connections (user_id, token, token_status, timestamp_in, node_id, node_ip, last_updated) VALUES ('" . $this->getId() . "', '$token', '" . TOKEN_UNUSED . "', CURRENT_TIMESTAMP, '$node_id', '$node_ip', CURRENT_TIMESTAMP)", false); 
    452452                $retval = $token; 
  • trunk/wifidog-auth/wifidog/login/index.php

    r1133 r1135  
    140140    $continueToAdmin = true; 
    141141} 
    142  
    143142/* 
    144143 * Start general request parameter processing section 
     
    149148        if($node) 
    150149        { 
    151             $session->set(SESS_NODE_ID_VAR, $node->getId); 
     150            $session->set(SESS_NODE_ID_VAR, $node->getId()); 
    152151        } 
    153152    } 
     
    205204                                // Login from a gateway, redirect to the gateway to activate the token 
    206205                                $token = $user->generateConnectionToken(); 
    207  
     206                if(!$token) 
     207                { 
     208                    throw new exception(sprintf(_("Unable to generate token for user %s"),$user->getUsername())); 
     209                } 
     210                else 
     211                { 
    208212                                header("Location: http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token); 
     213                } 
    209214                        } else { 
    210215                                // Virtual login, redirect to the auth server homepage 
  • trunk/wifidog-auth/wifidog/node_list.php

    r1127 r1135  
    9898// Sort according to above instructions 
    9999if ($sort_by_using_sql === true) 
    100     $sql = "SELECT node_id, name, last_heartbeat_user_agent, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS online, creation_date, node_deployment_status FROM nodes WHERE node_deployment_status != 'PERMANENTLY_CLOSED' ORDER BY {$sort_by_param}"; 
     100    $sql = "SELECT node_id, gw_id, name, last_heartbeat_user_agent, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS online, creation_date, node_deployment_status FROM nodes WHERE node_deployment_status != 'PERMANENTLY_CLOSED' ORDER BY {$sort_by_param}"; 
    101101else 
    102     $sql = "SELECT node_id, name, last_heartbeat_user_agent, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS online, creation_date, node_deployment_status FROM nodes WHERE node_deployment_status != 'PERMANENTLY_CLOSED' ORDER BY ".DEFAULT_SORT_BY_PARAM; 
     102    $sql = "SELECT node_id, gw_id, name, last_heartbeat_user_agent, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, last_heartbeat_ip, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS online, creation_date, node_deployment_status FROM nodes WHERE node_deployment_status != 'PERMANENTLY_CLOSED' ORDER BY ".DEFAULT_SORT_BY_PARAM; 
    103103$nodes_results = null; 
    104104$db->execSql($sql, $nodes_results, false);