Changeset 1434
- Timestamp:
- 12/09/09 14:06:04 (2 years ago)
- Location:
- branches/gbastien/wifidog
- Files:
-
- 6 modified
-
classes/Dependency.php (modified) (1 diff)
-
classes/MainUI.php (modified) (2 diffs)
-
classes/Session.php (modified) (1 diff)
-
classes/User.php (modified) (3 diffs)
-
login/index.php (modified) (6 diffs)
-
signup.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/gbastien/wifidog/classes/Dependency.php
r1416 r1434 128 128 'mandatory' => true, 129 129 "type" => "localLib", 130 "detectFiles" => "lib/PHPMailer_v 2.0.0/class.phpmailer.php",130 "detectFiles" => "lib/PHPMailer_v5.1/class.phpmailer.php", 131 131 'description' => "Required for sending mail", 132 132 'website' => "http://phpmailer.codeworxtech.com/", 133 'installSourceUrl' => "http:// superb-west.dl.sourceforge.net/sourceforge/phpmailer/PHPMailer_v2.0.0.tar.gz",133 'installSourceUrl' => "http://iweb.dl.sourceforge.net/sourceforge/phpmailer/PHPMailer_v5.1.tar.gz", 134 134 'installMethod' => "tarball", 135 135 'installDestination' => "/" -
branches/gbastien/wifidog/classes/MainUI.php
r1419 r1434 467 467 $_gwAddress = null; 468 468 $_gwPort = null; 469 $_mac = null; 469 470 $_selected = ""; 470 471 $_languageChooser = array (); … … 499 500 $_gwAddress = $session->get(SESS_GW_ADDRESS_VAR); 500 501 $_gwPort = $session->get(SESS_GW_PORT_VAR); 502 $_mac = $session->get(SESS_USER_MAC_VAR); 501 503 502 504 // If gateway information could be detected tell them to Smarty 503 505 if ($_gwId && $_gwAddress && $_gwPort) { 504 $this->smarty->assign('logoutParameters', "&gw_id=" . $_gwId . "&gw_address=" . $_gwAddress . "&gw_port=" . $_gwPort );506 $this->smarty->assign('logoutParameters', "&gw_id=" . $_gwId . "&gw_address=" . $_gwAddress . "&gw_port=" . $_gwPort . ($_mac? "&mac=".$_mac:"")); 505 507 } 506 508 } else { -
branches/gbastien/wifidog/classes/Session.php
r1421 r1434 45 45 define('SESS_USERNAME_VAR', 'SESS_USERNAME'); 46 46 define('SESS_USER_ID_VAR', 'SESS_USER_ID'); 47 define('SESS_USER_MAC_VAR', 'SESS_USER_MAC'); 47 48 define('SESS_PASSWORD_HASH_VAR', 'SESS_PASSWORD_HASH'); 48 49 define('SESS_ORIGINAL_URL_VAR', 'SESS_ORIGINAL_URL'); -
branches/gbastien/wifidog/classes/User.php
r1428 r1434 639 639 @return true on success, false on failure 640 640 */ 641 function generateConnectionToken( ) {641 function generateConnectionToken($mac = null) { 642 642 if ($this->isUserValid()) { 643 643 $db = AbstractDb::getObject(); … … 648 648 $node_ip = $db->escapeString($_SERVER['REMOTE_ADDR']); 649 649 } 650 650 651 if ($session && $node_ip && $session->get(SESS_NODE_ID_VAR)) { 651 652 //echo "$session && $node_ip && {$session->get(SESS_NODE_ID_VAR)}"; 652 653 $node_id = $db->escapeString($session->get(SESS_NODE_ID_VAR)); 653 $abuseControlFault = User::isAbuseControlViolated($this, null, Node::getObject($node_id));654 $abuseControlFault = User::isAbuseControlViolated($this, $mac, Node::getObject($node_id)); 654 655 if($abuseControlFault) { 655 656 throw new Exception ($abuseControlFault); 656 657 } 658 $mac = (is_null($mac)?'': $db->escapeString($mac)); 657 659 /* 658 660 * Delete all unused tokens for this user, so we don't fill the database … … 663 665 664 666 $sql .= "INSERT INTO tokens (token_owner, token_issuer, token_id, token_status) VALUES ('" . $this->getId() . "', '" . $this->getId() . "', '$token', '" . TOKEN_UNUSED . "');\n"; 665 $sql .= "INSERT INTO connections (user_id, token_id, timestamp_in, node_id, node_ip, last_updated ) VALUES ('" . $this->getId() . "', '$token', CURRENT_TIMESTAMP, '$node_id', '$node_ip', CURRENT_TIMESTAMP)";667 $sql .= "INSERT INTO connections (user_id, token_id, timestamp_in, node_id, node_ip, last_updated, user_mac) VALUES ('" . $this->getId() . "', '$token', CURRENT_TIMESTAMP, '$node_id', '$node_ip', CURRENT_TIMESTAMP, '$mac')"; 666 668 $db->execSqlUpdate($sql, false); 667 669 $retval = $token; -
branches/gbastien/wifidog/login/index.php
r1419 r1434 88 88 $gw_port = null; 89 89 $gw_id = null; 90 $mac = null; 90 91 $logout = null; 91 92 … … 118 119 exit; 119 120 } 121 122 if (isset($_REQUEST["mac"])) { 123 $session->set(SESS_USER_MAC_VAR, $_REQUEST['mac']); 124 $mac = $_REQUEST['mac']; 125 } 126 120 127 121 128 /* … … 182 189 // Login from a gateway, redirect to the gateway to activate the token 183 190 $user = $network->getSplashOnlyUser(); 184 $token = $user->generateConnectionToken( );191 $token = $user->generateConnectionToken($mac); 185 192 User::setCurrentUser($user); 186 193 header("Location: http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token); … … 206 213 if (!empty($gw_address) && !empty($gw_port)) { 207 214 // Login from a gateway, redirect to the gateway to activate the token 208 $token = $user->generateConnectionToken( );215 $token = $user->generateConnectionToken($mac); 209 216 if(!$token) 210 217 { … … 245 252 $smarty->assign('gw_port', $gw_port); 246 253 $smarty->assign('gw_id', $gw_id); 254 $smarty->assign('mac', $mac); 247 255 248 256 // Get the login form … … 256 264 if ($gw_id != null) 257 265 $html .= "<input type='hidden' name='gw_id' value='{$gw_id}'>\n"; 266 if ($mac != null) 267 $html .= "<input type='hidden' name='mac' value='{$mac}'>\n"; 258 268 $html .= Authenticator::getLoginUI(); 259 269 $html .= "</form>\n"; -
branches/gbastien/wifidog/signup.php
r1421 r1434 228 228 $gw_address = $session->get(SESS_GW_ADDRESS_VAR); 229 229 $gw_port = $session->get(SESS_GW_PORT_VAR); 230 $mac = $session->get(SESS_USER_MAC_VAR); 230 231 231 232 if ($gw_id && $gw_address && $gw_port) { 232 233 // Make sure the user IDs match 233 234 if(($created_user->getId() == $authenticated_user->getId())) { 234 $token = $created_user->generateConnectionToken( );235 $token = $created_user->generateConnectionToken($mac); 235 236 236 237 $redirURL = "http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token;
