Changeset 1018

Show
Ignore:
Timestamp:
04/23/06 10:09:18 (7 years ago)
Author:
rob_janes
Message:

* javascript for validating and navigating forms.
* help text (untranslated).
* EVENT_LOGGING enabling/disabling flag.
* use SYSTEM_PATH instead of BASE_URL_PATH and BASE_SSL_PATH where ever appropriate.
* standardize Smarty variables for Network and User info by adding assignSmartyValues($smarty, $self) to Network and User.
* change_password only allowed if logged in.
* non-superadmin can only use change_password to change their own password.
* superadmin can use change_password to change any user password by entering in their password for the old password.
* page_header div defined and positioned in MainUI

Location:
trunk/wifidog-auth
Files:
3 added
30 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1016 r1018  
     12006-04-17 Rob Janes <janes.rob@gmail.com> 
     2        * javascript for validating and navigating forms. 
     3        * help text (untranslated). 
     4        * EVENT_LOGGING enabling/disabling flag. 
     5        * use SYSTEM_PATH instead of BASE_URL_PATH and BASE_SSL_PATH where ever appropriate. 
     6        * standardize Smarty variables for Network and User info by adding assignSmartyValues($smarty, $self) to Network and User. 
     7        * change_password only allowed if logged in. 
     8        * non-superadmin can only use change_password to change their own password. 
     9        * superadmin can use change_password to change any user password by entering in their password for the old password. 
     10        * page_header div defined and positioned in MainUI 
     11 
    1122006-04-04 Benoit Grégoire  <bock@step.polymtl.ca> 
    213        * /classes/Content/IFrame/IFrame.php: Change a few methods from private to protected as the private methods broke IFrameRest 
  • trunk/wifidog-auth/wifidog/auth/index.php

    r914 r1018  
    7171    if (!$authenticator) 
    7272    { 
    73         $auth_message .= "| Error: Unable to instanciate authenticator. "; 
     73        $auth_message .= "| Error: Unable to instantiate authenticator. "; 
    7474        $auth_response = ACCOUNT_STATUS_ERROR; 
    7575    } 
     
    9797            } 
    9898            else 
    99                 if ($info['token_status'] == TOKEN_INUSE && $info['gw_id'] == $_REQUEST['gw_id'] && $info['mac'] == $_REQUEST['mac'] && $info['ip'] == $_REQUEST['ip']) 
     99                if ($info['token_status'] == TOKEN_INUSE && 
     100                                        isset($info['gw_id']) && isset($_REQUEST['gw_id']) && $info['gw_id'] == $_REQUEST['gw_id'] && 
     101                                        isset($info['mac']) && isset($_REQUEST['mac']) && $info['mac'] == $_REQUEST['mac'] && 
     102                                        isset($info['ip']) && isset($_REQUEST['ip']) && $info['ip'] == $_REQUEST['ip']) 
    100103                { 
    101104                    // This solves the bug where the user clicks twice before getting the portal page 
  • trunk/wifidog-auth/wifidog/change_password.php

    r1009 r1018  
    5555require_once('classes/User.php'); 
    5656 
    57 isset($_REQUEST["username"]) && $smarty->assign("username", $_REQUEST["username"]); 
     57$smarty->assign('error', ''); 
    5858 
    59 if (isset($_REQUEST["submit"])) { 
     59$smarty->assign('username', ''); 
     60$smarty->assign('oldpassword', ''); 
     61$smarty->assign('newpassword', ''); 
     62$smarty->assign('newpassword_again', ''); 
     63 
     64$user = User::getCurrentUser(); 
     65if ($user) { 
     66        User::assignSmartyValues($smarty, $user); 
     67 
     68        if ($user->isSuperAdmin() && isset($_REQUEST['username'])) { 
     69                $smarty->assign('username', $_REQUEST['username']); 
     70                $username = $_REQUEST['username']; 
     71        } 
     72        else 
     73                $username = $user->getUsername(); 
     74 
     75        // $user->getEmail(); 
     76        // $user->getRealName(); 
     77        // $user->getWebsiteURL(); 
     78        // $user->isSuperAdmin(); 
     79        // $user->isOwner(); 
     80} 
     81else { 
     82        $smarty->assign('error', _("You must login before you can change your password.")); 
     83} 
     84 
     85if ($user && isset($_REQUEST["form_request"])) { 
    6086    try { 
    6187        // If the source is present and that it's in our, save it to a var for later use 
     
    6490        if (!$account_origin || !$_REQUEST["username"] || !$_REQUEST["oldpassword"] || !$_REQUEST["newpassword"] || !$_REQUEST["newpassword_again"]) 
    6591            throw new Exception(_('You MUST fill in all the fields.')); 
    66         $username = $db->escapeString(trim($_REQUEST['username'])); 
     92 
    6793        $current_password = $db->escapeString(trim($_REQUEST['oldpassword'])); 
    6894        $new_password = $db->escapeString(trim($_REQUEST['newpassword'])); 
     
    75101 
    76102        // Warning for now, password change only works for local users, registered through our signup process. 
    77         $user = User::getUserByUsernameAndOrigin($username, $account_origin); 
    78         if ($user->getPasswordHash() != User::passwordHash($current_password)) 
    79             throw new Exception(_("Wrong password.")); 
     103                if ($username == $user->getUsername()) { 
     104                        $victim = $user; 
    80105 
    81         $user->SetPassword($new_password); 
     106                        if ($victim->getPasswordHash() != User::passwordHash($current_password)) 
     107                                throw new Exception(_("Wrong password.")); 
     108 
     109                        $victim->setPassword($new_password); 
     110                        $smarty->assign("message", _("Your password has been changed succesfully.")); 
     111                } 
     112                else { 
     113                        if ($user->isSuperAdmin()) { 
     114                                $username =  $db->escapeString(trim($_REQUEST['username'])); 
     115                                $victim = User::getUserByUsernameAndOrigin($username, $account_origin); 
     116 
     117                                if (!$victim) 
     118                                        throw new Exception(sprintf(_('Sorry, user %s does not exist !'), $username)); 
     119 
     120                                if ($victim->getPasswordHash() != User::passwordHash($current_password) 
     121                                        && $user->getPasswordHash() != User::passwordHash($current_password)) 
     122                                        throw new Exception(_("Wrong password.")); 
     123 
     124                                $victim->setPassword($new_password); 
     125                                $smarty->assign("message", sprintf(_('The password for %s has been successfully changed.'), $username)); 
     126                        } 
     127                        else { 
     128                                throw new Exception(_('Sorry, invalid change password request !')); 
     129                        } 
     130                } 
     131 
    82132        $ui = new MainUI(); 
    83         $smarty->assign("message", _("Your password has been changed succesfully.")); 
    84133        $ui->appendContent('main_area_middle', $smarty->fetch("templates/sites/validate.tpl")); 
    85134        $ui->display(); 
     135 
    86136        exit; 
    87137    } catch (Exception $e) { 
  • trunk/wifidog-auth/wifidog/classes/MainUI.php

    r1013 r1018  
    130130    private $footer_scripts = array (); 
    131131 
     132        private $shrink_left_area = false; 
     133 
    132134    /** 
    133135     * Contructor 
     
    205207        $this->title = $title_string; 
    206208    } 
     209 
     210    public function shrinkLeftArea() { 
     211                $this->shrink_left_area = true; 
     212        } 
    207213 
    208214    /** 
     
    280286 
    281287                    // Init ALL smarty values 
    282                     $this->smarty->assign('isSuperAdmin', false); 
    283                     $this->smarty->assign('isOwner', false); 
     288                                        User::assignSmartyValues($this->smarty, $_currentUser); 
    284289                    $this->smarty->assign('formAction', ""); 
    285290                    $this->smarty->assign('nodeUI', ""); 
    286291                    $this->smarty->assign('networkUI', ""); 
    287  
    288                     // Define user security levels for the template 
    289                     $this->smarty->assign('isSuperAdmin', $_currentUser && $_currentUser->isSuperAdmin()); 
    290                     $this->smarty->assign('isOwner', $_currentUser && $_currentUser->isOwner()); 
    291292 
    292293                    /* 
     
    359360                $_currentUser = User :: getCurrentUser(); 
    360361 
    361                 // Init ALL smarty values 
    362                 $this->smarty->assign('networkHomepageURL', ""); 
    363                 $this->smarty->assign('networkName', ""); 
    364                 $this->smarty->assign('isValidUser', false); 
    365                 $this->smarty->assign('username', ""); 
     362                                User::assignSmartyValues($this->smarty, $_currentUser); 
     363 
    366364                $this->smarty->assign('logoutParameters', ""); 
    367365                $this->smarty->assign('loginParameters', ""); 
     
    370368                $this->smarty->assign('accountInformation', ""); 
    371369                $this->smarty->assign('techSupportInformation', ""); 
     370                $this->smarty->assign('shrinkLeftArea', $this->shrink_left_area); 
    372371 
    373372                // Provide Smarty with information about the network 
    374                 $this->smarty->assign('networkHomepageURL', Network :: getCurrentNetwork()->getHomepageURL()); 
    375                 $this->smarty->assign('networkName', Network :: getCurrentNetwork()->getName()); 
     373                                Network::assignSmartyValues($this->smarty); 
    376374 
    377375                /* 
     
    381379                if ($_currentUser != null) { 
    382380                    // User is logged in 
    383                     $this->smarty->assign('isValidUser', true); 
    384  
    385                     // Set username for Smarty 
    386                     $this->smarty->assign('username', $_currentUser->getUsername()); 
    387381 
    388382                    // Detect gateway information 
     
    447441     * 
    448442     * @access public 
    449      * @internal Uses a few request parameters to displaty debug information. 
     443     * @internal Uses a few request parameters to display debug information. 
    450444     * If $_REQUEST['debug_request'] is present, it will print out the 
    451445     * $_REQUEST array at the top of the page. 
     
    460454        $this->smarty->assign('stylesheetURL', ""); 
    461455        $this->smarty->assign('stylesheetParsedFile', ""); 
    462         $this->smarty->assign('isSuperAdmin', false); 
    463         $this->smarty->assign('isOwner', false); 
     456        // $this->smarty->assign('isSuperAdmin', false); 
     457        // $this->smarty->assign('isOwner', false); 
    464458        $this->smarty->assign('debugRequested', false); 
    465459        $this->smarty->assign('debugOutput', ""); 
     
    496490 
    497491        // Get information about user 
    498         $_currentUser = User :: getCurrentUser(); 
    499  
    500         // Define user security levels for the template 
    501         $this->smarty->assign('isSuperAdmin', $_currentUser && $_currentUser->isSuperAdmin()); 
    502         $this->smarty->assign('isOwner', $_currentUser && $_currentUser->isOwner()); 
    503  
    504         if (isset ($_REQUEST['debug_request']) && ($_currentUser && $_currentUser->isSuperAdmin())) { 
    505             // Tell Smarty everything it needs to know 
    506             $this->smarty->assign('debugRequested', true); 
    507             $this->smarty->assign('debugOutput', print_r($_REQUEST, true)); 
    508         } 
     492                User::assignSmartyValues($this->smarty); 
     493 
     494                $this->appendContent('page_header', $this->customBanner()); 
    509495 
    510496        /* 
     
    537523     */ 
    538524    function displayError($errmsg, $show_tech_support_email = true) { 
    539             // Init ALL smarty values 
    540     $this->smarty->assign("error", ""); 
     525        // Init ALL smarty values 
     526        $this->smarty->assign("error", ""); 
    541527        $this->smarty->assign("show_tech_support_email", false); 
    542528        $this->smarty->assign("tech_support_email", ""); 
     
    559545    } 
    560546 
     547        static public function redirect($redirect_url, $redirect_to_title=null, $timeout=60) { 
     548                if (!$redirect_to_title) { 
     549                        $network = Network :: getCurrentNetwork(); 
     550                        $redirect_to_title = $network ? sprintf(_("%s Login"), $network->getName()) : _("Login"); 
     551                } 
     552 
     553                header("Location: $redirect_url"); 
     554                echo "<html>\n" . 
     555                        "<head><meta http-equiv='Refresh' content='$timeout; URL=$redirect_url'/></head>\n". 
     556                        "<body>\n" . 
     557                        "<noscript>\n" . 
     558                        "<span style='display:none;'>\n" . 
     559                        "<h1>" . $redirect_to_title . "</h1>\n" . 
     560                        sprintf(_("Click <a href='%s'>here</a> to continue"), $redirect_url) . "<br/>\n" . 
     561                        _("The transfer from secure login back to regular http may cause a warning.") . "\n" . 
     562                        "</span>\n" . 
     563                        "</noscript>\n" . 
     564                        "</body>\n" . 
     565                        "</html>\n" 
     566                        ; 
     567                exit; 
     568        } 
     569 
     570        public function customBanner() { 
     571                $custom_banner = ''; 
     572 
     573                return $custom_banner; 
     574        } 
    561575} 
    562576 
  • trunk/wifidog-auth/wifidog/classes/Network.php

    r1013 r1018  
    16271627        } 
    16281628 
     1629        public static function assignSmartyValues($smarty, $net=null) { 
     1630                if (!$net) $net = Network::getCurrentNetwork(); 
     1631 
     1632                $smarty->assign('networkName', $net ? $net->getName() : ''); 
     1633                $smarty->assign('networkHomepageURL', $net ? $net->getHomepageURL() : ''); 
     1634                // Set networks usage information 
     1635                $smarty->assign('networkNumValidUsers', $net ? $net->getNumValidUsers() : 0); 
     1636                $smarty->assign('networkNumOnlineUsers', $net ? $net->getNumOnlineUsers() : 0); 
     1637 
     1638                // Set networks node information 
     1639                $smarty->assign('networkNumDeployedNodes', $net ? $net->getNumDeployedNodes() : 0); 
     1640                $smarty->assign('networkNumOnlineNodes', $net ? $net->getNumOnlineNodes() : 0); 
     1641        } 
    16291642} 
    16301643 
  • trunk/wifidog-auth/wifidog/classes/NodeLists/NodeListRSS.php

    r1013 r1018  
    247247 
    248248        // image 
    249         if (file_exists(WIFIDOG_ABS_FILE_PATH . "local_content/common/" . NETWORK_LOGO_NAME)) { 
     249        if (defined('NETWORK_LOGO_NAME') && file_exists(WIFIDOG_ABS_FILE_PATH . "local_content/common/" . constant('NETWORK_LOGO_NAME'))) { 
    250250            $_image = $this->_xmldoc->createElement("image"); 
    251251            $_channel->appendChild($_image); 
     
    320320                if ($_node->getDeploymentStatus() != 'NON_WIFIDOG_NODE') { 
    321321                    if ($_nodeData['is_up'] == 't') { 
    322                         $_descriptionText .= "<img src='" . BASE_URL_PATH . "images/HotspotStatus/up.gif' alt='' />"; 
     322                        $_descriptionText .= "<img src='" . SYSTEM_PATH . "images/HotspotStatus/up.gif' alt='' />"; 
    323323                    } else { 
    324                         $_descriptionText .= "<img src='" . BASE_URL_PATH . "images/HotspotStatus/down.gif' alt='' />"; 
     324                        $_descriptionText .= "<img src='" . SYSTEM_PATH . "images/HotspotStatus/down.gif' alt='' />"; 
    325325                    } 
    326326                } 
  • trunk/wifidog-auth/wifidog/classes/SmartyWifidog.php

    r1013 r1018  
    121121/* Useful stuff from config.php */ 
    122122 
     123        $this->assign('system_path', SYSTEM_PATH); 
    123124        $this->assign('base_url_path', BASE_URL_PATH); 
    124125        $this->assign('base_ssl_path', BASE_SSL_PATH); 
  • trunk/wifidog-auth/wifidog/classes/User.php

    r1013 r1018  
    810810    } 
    811811 
     812    /** Set Smarty template values.  Standardization routine. */ 
     813        public static function assignSmartyValues($smarty, $user=null) { 
     814                if (!$user) $user = User::getCurrentUser(); 
     815                $smarty->assign('username', $user ? $user->getUsername() : ''); 
     816 
     817                /** 
     818                 * Define user security levels for the template 
     819                 * 
     820                 * These values are used in the default template of WiFoDog but could be 
     821                 * used in a customized template to restrict certain links to specific 
     822                 * user access levels. 
     823                 */ 
     824                $smarty->assign('isValidUser', $user ? true : false); 
     825                $smarty->assign('isSuperAdmin', $user && $user->isSuperAdmin()); 
     826                $smarty->assign('isOwner', $user && $user->isOwner()); 
     827 
     828        if (isset ($_REQUEST['debug_request']) && ($user && $user->isSuperAdmin())) { 
     829            // Tell Smarty everything it needs to know 
     830            $smarty->assign('debugRequested', true); 
     831            $smarty->assign('debugOutput', print_r($_REQUEST, true)); 
     832        } 
     833        } 
    812834} 
    813835 
  • trunk/wifidog-auth/wifidog/include/common.php

    r1002 r1018  
    7272require_once('classes/EventLogging.php'); 
    7373 
    74 EventLogging::SetupErrorHandling( "strict~/var:\sDeprecated/(off)", 
    75                                                                   array( 'print' => new PrintChannel(new HTMLFormatter(), 'warning,notice', null, true), 
    76                                                                                  'debug' => new PrintChannel(new HTMLCommentsFormatter(), '=debug', null, false) ) 
    77                                                                   ); 
     74if (!defined('EVENT_LOGGING') || constant('EVENT_LOGGING')) { 
     75        EventLogging::SetupErrorHandling( "strict~/var:\sDeprecated/(off)", 
     76                                                                          array( 'print' => new PrintChannel(new HTMLFormatter(), 'warning,notice', null, true), 
     77                                                                                         'debug' => new PrintChannel(new HTMLCommentsFormatter(), '=debug', null, false) ) 
     78                                                                          ); 
     79} 
    7880require_once('classes/AbstractDb.php'); 
    7981require_once('classes/Locale.php'); 
     
    371373} 
    372374 
    373 $myLogfile = !defined('WIFIDOG_LOGFILE') ? "tmp/wifidog.log" : constant('WIFIDOG_LOGFILE'); 
    374 if (!empty($myLogfile)) { 
    375         if (substr($myLogfile,0,1) != '/') $myLogfile = WIFIDOG_ABS_FILE_PATH.$myLogfile; 
     375if (!defined('EVENT_LOGGING') || constant('EVENT_LOGGING')) { 
     376        $myLogfile = !defined('WIFIDOG_LOGFILE') ? "tmp/wifidog.log" : constant('WIFIDOG_LOGFILE'); 
     377        if (!empty($myLogfile)) { 
     378                if (substr($myLogfile,0,1) != '/') $myLogfile = WIFIDOG_ABS_FILE_PATH.$myLogfile; 
    376379         
    377         EventLogging::stAddChannel( new FileChannel($myLogfile, new WifidogSyslogFormatter(), 'warning,notice'), 'logfile' ); 
    378 } 
    379  
    380 // trigger_error("here i am", E_USER_NOTICE); 
     380                EventLogging::stAddChannel( new FileChannel($myLogfile, new WifidogSyslogFormatter(), 'warning,notice'), 'logfile' ); 
     381        } 
     382 
     383        // trigger_error("here i am", E_USER_NOTICE); 
     384} 
    381385 
    382386/* 
  • trunk/wifidog-auth/wifidog/include/path_defines_url_content.php

    r1009 r1018  
    5252//echo "<pre>";print_r($_SERVER);echo "</pre>"; 
    5353 
    54 $curent_url = 'http'; 
     54$current_url = 'http'; 
    5555if ($_SERVER['SERVER_PORT'] == '443') { 
    56     $curent_url .= 's'; 
     56    $current_url .= 's'; 
    5757} 
    58 $curent_url .= '://'.$_SERVER['HTTP_HOST']; 
     58$current_url .= '://'.$_SERVER['HTTP_HOST']; 
    5959if ($_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) 
    60     $curent_url .= ':'.$_SERVER['SERVER_PORT']; 
    61 $curent_url .= $_SERVER['REQUEST_URI']; 
     60    $current_url .= ':'.$_SERVER['SERVER_PORT']; 
     61$current_url .= $_SERVER['REQUEST_URI']; 
    6262 
    6363/** 
    6464 * Define current request URL 
    6565 */ 
    66 define('CURRENT_REQUEST_URL', $curent_url); 
     66define('CURRENT_REQUEST_URL', $current_url); 
    6767 
    6868if (SSL_AVAILABLE) { 
     
    8282 
    8383/* If we actually ARE in SSL mode, make all URLS http:// to avoid security warnings. */ 
    84 if (isset ($_SERVER['HTTPS'])) { 
    85     /** 
    86      * Define base web address to use (this time using SLL) 
    87      */ 
    88     define('BASE_URL_PATH', BASE_SSL_PATH); 
    89 } 
    90 else { 
     84// no no no just use the SYSTEM_PATH ... use /login/index.php rather than http://auth.wirelesstoronto.ca/login/index.php 
     85// if (isset ($_SERVER['HTTPS'])) { 
     86//    /** 
     87//     * Define base web address to use (this time using SLL) 
     88//     */ 
     89//    define('BASE_URL_PATH', BASE_SSL_PATH); 
     90// } 
     91// else { 
    9192    /** 
    9293     * Define base web address to use 
     
    9596     */ 
    9697    define('BASE_URL_PATH', BASE_NON_SSL_PATH); 
    97 } 
     98// } 
    9899 
    99100/** 
     
    118119 * Define URLs 
    119120 */ 
    120 define('NODE_CONTENT_URL', BASE_URL_PATH.LOCAL_CONTENT_REL_PATH.CURRENT_NODE_ID.'/'); 
     121// define('NODE_CONTENT_URL', BASE_URL_PATH.LOCAL_CONTENT_REL_PATH.CURRENT_NODE_ID.'/'); 
     122define('NODE_CONTENT_URL', SYSTEM_PATH.LOCAL_CONTENT_REL_PATH.CURRENT_NODE_ID.'/'); 
    121123define('NODE_CONTENT_PHP_RELATIVE_PATH', LOCAL_CONTENT_REL_PATH.CURRENT_NODE_ID.'/'); 
    122124 
    123 define('COMMON_CONTENT_URL', BASE_URL_PATH.LOCAL_CONTENT_REL_PATH.'common/'); 
     125// define('COMMON_CONTENT_URL', BASE_URL_PATH.LOCAL_CONTENT_REL_PATH.'common/'); 
     126define('COMMON_CONTENT_URL', SYSTEM_PATH.LOCAL_CONTENT_REL_PATH.'common/'); 
    124127 
    125 define('GENERIC_OBJECT_ADMIN_ABS_HREF', BASE_URL_PATH.'admin/generic_object_admin.php'); 
    126 define('CONTENT_ADMIN_ABS_HREF', BASE_URL_PATH.'admin/content_admin.php'); 
     128// define('GENERIC_OBJECT_ADMIN_ABS_HREF', BASE_URL_PATH.'admin/generic_object_admin.php'); 
     129define('GENERIC_OBJECT_ADMIN_ABS_HREF', SYSTEM_PATH.'admin/generic_object_admin.php'); 
     130// define('CONTENT_ADMIN_ABS_HREF', BASE_URL_PATH.'admin/content_admin.php'); 
     131define('CONTENT_ADMIN_ABS_HREF', SYSTEM_PATH.'admin/content_admin.php'); 
    127132 
    128133?> 
  • trunk/wifidog-auth/wifidog/index.php

    r1009 r1018  
    6363 
    6464// Init ALL smarty values 
    65 $smarty->assign('isSuperAdmin', false); 
    66 $smarty->assign('isOwner', false); 
    67 $smarty->assign('networkName', ""); 
    68 $smarty->assign('networkNumValidUsers', 0); 
    69 $smarty->assign('networkNumOnlineUsers', 0); 
    70 $smarty->assign('networkNumDeployedNodes', 0); 
    71 $smarty->assign('networkNumOnlineNodes', 0); 
    7265$smarty->assign('googleMapsEnabled', false); 
    7366 
    7467// Get information about network 
    7568$network = Network::getCurrentNetwork(); 
     69Network::assignSmartyValues($smarty, $network); 
    7670 
    7771// Get information about user 
    78 $currentUser = User::getCurrentUser(); 
    79  
    80 /** 
    81  * Define user security levels for the template 
    82  * 
    83  * These values are used in the default template of WiFoDog but could be used 
    84  * in a customized template to restrict certain links to specific user 
    85  * access levels. 
    86  */ 
    87 $smarty->assign('isSuperAdmin', $currentUser && $currentUser->isSuperAdmin()); 
    88 $smarty->assign('isOwner', $currentUser && $currentUser->isOwner()); 
     72User::assignSmartyValues($smarty); 
    8973 
    9074/* 
     
    10892// Set section of Smarty template 
    10993$smarty->assign('sectionMAINCONTENT', true); 
    110  
    111 // Set networks information 
    112 $smarty->assign('networkName', $network->getName()); 
    113  
    114 // Set networks user information 
    115 $smarty->assign('networkNumValidUsers', $network->getNumValidUsers()); 
    116 $smarty->assign('networkNumOnlineUsers', $network->getNumOnlineUsers()); 
    117  
    118 // Set networks node information 
    119 $smarty->assign('networkNumDeployedNodes', $network->getNumDeployedNodes()); 
    120 $smarty->assign('networkNumOnlineNodes', $network->getNumOnlineNodes()); 
    12194 
    12295// Set Google maps information 
  • trunk/wifidog-auth/wifidog/local_content/default/stylesheet.css

    r883 r1018  
    1111.bodyBackColor { 
    1212{/literal} 
    13         background : #dbffa8 url({$base_url_path}images/bg_body.gif) repeat-x fixed 0px 0px; 
     13        background : #dbffa8 url({$system_path}images/bg_body.gif) repeat-x fixed 0px 0px; 
    1414{literal} 
    1515} 
     
    1717div.navigation { 
    1818{/literal} 
    19         background-image: url({$base_url_path}images/01_nav.gif); 
     19        background-image: url({$system_path}images/01_nav.gif); 
    2020{literal} 
    2121} 
     
    2323div.avis{ 
    2424{/literal} 
    25         background-image: url({$base_url_path}images/03_avis.gif); 
     25        background-image: url({$system_path}images/03_avis.gif); 
    2626{literal} 
    2727} 
  • trunk/wifidog-auth/wifidog/locale/de/LC_MESSAGES/messages.po

    r1001 r1018  
    16111611 
    16121612#: ../login/index.php:124 ../login/index.php:125 ../login/index.php:197 
    1613 msgid "Your must specify your username and password" 
     1613msgid "You must specify your username and password" 
    16141614msgstr "Sie müssen ihren Benutzernamen und ihr Passwort angeben" 
    16151615 
  • trunk/wifidog-auth/wifidog/locale/fr/LC_MESSAGES/messages.po

    r1001 r1018  
    30973097#: ../login/index.php:125 
    30983098#: ../login/index.php:197 
    3099 msgid "Your must specify your username and password" 
     3099msgid "You must specify your username and password" 
    31003100msgstr "Veuillez entrer un nom d'usager et un mot de passe" 
    31013101 
  • trunk/wifidog-auth/wifidog/locale/pt/LC_MESSAGES/messages.po

    r1001 r1018  
    25662566 
    25672567#: ../login/index.php:124 ../login/index.php:125 ../login/index.php:197 
    2568 msgid "Your must specify your username and password" 
     2568msgid "You must specify your username and password" 
    25692569msgstr "Voc&ecirc; precisa especificar seu usu&aacute;rio e senha" 
    25702570 
  • trunk/wifidog-auth/wifidog/login/index.php

    r1013 r1018  
    3939 * The login page will both display the login page, and process login and logout 
    4040 * request. 
     41 * 
     42 * Hotspots redirect newly active PCs to this page with this url: 
     43 * Refering to the wifidog.conf installed on the hotspot: 
     44 * 
     45 * {PROTOCOL}://{HOSTNAME}:{PORT}{PATH}login?gw_address=A&gw_port=P&gw_id=I&url=URL 
     46 * 
     47 * PROTOCOL, HOSTNAME, PORT and PATH refer to the settings for the hotspot's 
     48 * currently selected authserver. 
     49 * PROTOCOL http or https if SSLAvailable is yes for the hotspot's current authserver 
     50 * HOSTNAME Hostname of the current authserver 
     51 * PORT is HTTPPort or SSLPort of the current authserver 
     52 * PATH is the Path of the current authserver.  PATH starts and ends with a / 
     53 * 
     54 * gw_address is GatewayAddress from the config file 
     55 * gw_port is GatewayPort 
     56 * gw_id is GatewayID, is node id 
     57 * url is the original url requested but redirected here by the hotspot wifidog 
     58 * 
     59 * http://auth.wirelesstoronto.ca:80/login?gw_address=207.50.119.2&gw_port=2060&gw_id=215&url=http://hotmail.com 
    4160 * 
    4261 * @package    WiFiDogAuthServer 
     
    6079require_once('classes/Network.php'); 
    6180require_once('classes/MainUI.php'); 
     81// require_once('lib/magpie/rss_fetch.inc'); // Added so RSS code which depends on the Magpie RSS functions will work. // 
    6282 
    6383// Init values 
     
    7090$logout = null; 
    7191 
     92$create_a_free_account = _("Create a free account"); 
     93 
    7294/* 
    7395 * General request parameter processing section 
     
    101123} 
    102124 
     125if (isset($_REQUEST["form_signup"]) && $_REQUEST["form_signup"] == $create_a_free_account) { 
     126        MainUI::redirect(SYSTEM_PATH . "signup.php"); 
     127        exit; 
     128} 
     129 
    103130/* 
    104131 * Store original URL typed by user 
     
    119146    try { 
    120147        $node = Node::getObject($gw_id); 
    121         $hotspot_name = $node->getName(); 
    122         $network = $node->getNetwork(); 
    123148    } 
    124149 
     
    128153        exit; 
    129154    } 
     155 
     156        $network = $node->getNetwork(); 
    130157} else { 
    131158    // Gateway ID is not set ... virtual login 
    132159    $network = Network::getCurrentNetwork(); 
    133     $node = null; 
     160    $node = Node::getObject('default'); 
    134161} 
    135162 
     
    160187 * Normal login process 
    161188 */ 
    162 if (!empty($username) && !empty($password)) { 
    163     // Init values 
    164     $errmsg = ''; 
    165     // Authenticating the user through the selected auth source. 
    166     $network = Network::processSelectNetworkUI('auth_source'); 
    167  
    168     $user = $network->getAuthenticator()->login($username, $password, $errmsg); 
    169  
    170     if ($user != null) { 
    171         if (!empty($gw_address) && !empty($gw_port)) { 
    172             // Login from a gateway, redirect to the gateway to activate the token 
    173             $token = $user->generateConnectionToken(); 
    174  
    175             header("Location: http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token); 
    176         } else { 
    177             // Virtual login, redirect to the auth server homepage 
    178             header("Location: " . BASE_SSL_PATH . ($continueToAdmin ? "admin/" : "")); 
    179         } 
    180  
    181         exit; 
    182     } else { 
    183         $error = $errmsg; 
    184     } 
    185 } else { 
    186     /* 
    187      * Note that this is executed even when we have just arrived at the login 
    188      * page, so  the user is reminded to supply a username and password 
    189      */ 
    190     $error = _('Your must specify your username and password'); 
     189if (isset ($_REQUEST["form_request"]) && $_REQUEST["form_request"] == "login") { 
     190        if (!empty($username) && !empty($password)) { 
     191                // Init values 
     192                $errmsg = ''; 
     193                // Authenticating the user through the selected auth source. 
     194                $network = Network::processSelectNetworkUI('auth_source'); 
     195 
     196                $user = $network->getAuthenticator()->login($username, $password, $errmsg); 
     197 
     198                if ($user != null) { 
     199                        if (!empty($gw_address) && !empty($gw_port)) { 
     200                                // Login from a gateway, redirect to the gateway to activate the token 
     201                                $token = $user->generateConnectionToken(); 
     202 
     203                                header("Location: http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token); 
     204                        } else { 
     205                                // Virtual login, redirect to the auth server homepage 
     206                                header("Location: " . BASE_SSL_PATH . ($continueToAdmin ? "admin/" : "")); 
     207                        } 
     208 
     209                        exit; 
     210                } else { 
     211                        $error = $errmsg; 
     212                } 
     213        } 
    191214} 
    192215 
     
    204227 */ 
    205228  
    206 // Init ALL smarty values 
    207 $smarty->assign('node', null); 
    208 $smarty->assign('gwAddress', null); 
    209 $smarty->assign('gwPort', null); 
    210 $smarty->assign('gwId', null); 
    211 $smarty->assign('origin', null); 
    212 $smarty->assign('selectNetworkUI', null); 
    213 $smarty->assign('username', null); 
    214 $smarty->assign('error', null); 
    215  
    216229/* 
    217230 * Tool content 
     
    225238 
    226239// Check if user wanted to enter the administration interface 
    227 if (!empty($_REQUEST['origin'])) { 
    228     $smarty->assign('origin', $_REQUEST['origin']); 
    229 } 
     240$smarty->assign('origin', empty($_REQUEST['origin']) ? null : $_REQUEST['origin']); 
    230241 
    231242// Set network selector 
     
    238249$smarty->assign('error', !empty($error) ? $error : null); 
    239250 
     251$smarty->assign('create_a_free_account', $create_a_free_account); 
     252 
    240253// Compile HTML code 
    241254$html = $smarty->fetch("templates/sites/login.tpl"); 
    242255 
    243  
    244  
    245  
    246256$ui = new MainUI(); 
    247 if($node) 
    248 { 
    249 $ui->setTitle(sprintf(_("%s login page for %s"),$network->getName(), $node->getName())); 
    250 } 
    251 else 
    252 { 
     257if($node) { 
     258        $ui->setTitle(sprintf(_("%s login page for %s"), $network->getName(), $node->getName())); 
     259} else { 
    253260    $ui->setTitle(_("Offsite login page")); 
    254261} 
    255262$ui->setPageName('login'); 
     263$ui->shrinkLeftArea(); 
    256264$ui->appendContent('left_area_middle', $html); 
     265 
    257266/* 
    258267 * Main content 
     
    290299} 
    291300 
     301$ui->appendContent('main_area_middle', 
     302        "\n<h1>" . sprintf(_("Welcome to the %s Hotspot network."), $network->getName()) . "</h1>\n" . 
     303 
     304        "<p>" . 
     305        _("Please use the login/signup form on the left to activate your connection with the internet.") . 
     306        "</p>\n". 
     307 
     308        "<p>" . 
     309        _("If you already have an account please use that to login.") . " " . 
     310        _("Thanks to the hospitality of your proprietor, this is a surfing free zone.") . " " . 
     311        _("Once you login you are welcome to use the internet as long as you like.") . 
     312        "</p>\n" . 
     313 
     314        "<p>" . 
     315        sprintf(_("If you are new to %s, please use the form on the left to create a new account."), $network->getName()) . " " . 
     316        _("There will be no charge for this service.") . 
     317        "</p>\n" 
     318); 
     319 
    292320/* 
    293321 * Render output 
     
    302330 * End: 
    303331 */ 
     332 
     333?> 
  • trunk/wifidog-auth/wifidog/lost_password.php

    r1009 r1018  
    7272$smarty->assign('SelectNetworkUI', ""); 
    7373 
    74 if (isset($_REQUEST['submit'])) { 
     74$smarty->assign('username', ""); 
     75$smarty->assign('email', ""); 
     76 
     77if (isset($_REQUEST['form_request'])) { 
    7578    $account_origin = Network::getObject($_REQUEST['auth_source']); 
    7679 
  • trunk/wifidog-auth/wifidog/lost_username.php

    r1009 r1018  
    7272$smarty->assign('SelectNetworkUI', ""); 
    7373 
    74 if (isset($_REQUEST["submit"])) { 
     74$smarty->assign('email', ""); 
     75 
     76if (isset($_REQUEST["form_request"])) { 
    7577    $account_origin = Network::getObject($_REQUEST['auth_source']); 
    7678 
  • trunk/wifidog-auth/wifidog/resend_validation.php

    r1009 r1018  
    6666 
    6767// Init ALL smarty values 
     68$smarty->assign('username', ""); 
    6869$smarty->assign('message', ""); 
    6970$smarty->assign('error', ""); 
     
    7273$smarty->assign('SelectNetworkUI', ""); 
    7374 
    74 if (isset($_REQUEST["submit"])) { 
     75if (isset($_REQUEST["form_request"])) { 
    7576    $account_origin = Network::getObject($_REQUEST['auth_source']); 
    7677 
  • trunk/wifidog-auth/wifidog/signup.php

    r1009 r1018  
    161161$smarty->assign('SelectNetworkUI', ""); 
    162162 
    163 if (isset ($_REQUEST["submit"])) { 
     163if (isset ($_REQUEST["form_request"]) && $_REQUEST["form_request"] == "signup") { 
    164164    // Secure entered values 
    165165    $username = trim($_REQUEST['username']); 
     
    221221        $created_user->sendValidationEmail(); 
    222222 
     223                // Authenticate this new user automatically 
     224                $errmsg = ""; 
     225                $authenticated_user = $network->getAuthenticator()->login($username, $password, $errmsg); 
     226 
     227                // While in validation period, alert user that he should validate his account ASAP 
     228                $validationMsgHtml = "<div id='warning_message_area'>\n"; 
     229                $validationMsgHtml .= _("An email with confirmation instructions was sent to your email address."); 
     230                $validationMsgHtml .= sprintf(_("Your account has been granted %s minutes of access to retrieve your email and validate your account."), ($network->getValidationGraceTime() / 60)); 
     231                $validationMsgHtml .= _('You may now open a browser window or start your email client and go to any remote Internet address to obtain the validation email.'); 
     232                $validationMsgHtml .= "</div>\n"; 
     233 
    223234        // If the user is at a REAL hotspot, give him his sign-up minutes right away 
    224235        $gw_id = $session->get(SESS_GW_ID_VAR); 
     
    227238 
    228239        if ($gw_id && $gw_address && $gw_port) { 
    229             // Init values 
    230             $errmsg = ""; 
    231  
    232             // Authenticate this new user automatically 
    233             $authenticated_user = $network->getAuthenticator()->login($username, $password, $errmsg); 
    234  
    235240            // Make sure the user IDs match 
    236241            if(($created_user->getId() == $authenticated_user->getId())) { 
    237242                $token = $created_user->generateConnectionToken(); 
    238243 
    239                 header("Location: http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token); 
     244                $redirURL = "http://" . $gw_address . ":" . $gw_port . "/wifidog/auth?token=" . $token; 
    240245            } else { 
    241                 header("Location: " . BASE_NON_SSL_PATH); 
     246                $redirURL = BASE_NON_SSL_PATH; 
    242247            } 
    243         } else { 
    244             $smarty->assign('message', _('An email with confirmation instructions was sent to your email address.  Your account has been granted 15 minutes of access to retrieve your email and validate your account.  You may now open a browser window and go to any remote Internet address to obtain the login page.')); 
     248 
     249                        MainUI::redirect($redirURL, 0); 
    245250        } 
    246251 
     
    252257         */ 
    253258        $ui = new MainUI(); 
     259 
    254260        $ui->appendContent('left_area_middle', $html); 
    255261        $ui->appendContent('main_area_middle', $html_body); 
     262 
     263                // $ui->appendContent('page_header', $validationMsgHtml); 
     264                $ui->appendContent('main_area_top', $validationMsgHtml); 
     265 
    256266        $ui->display(); 
    257267 
     
    276286 * Tool content 
    277287 */ 
     288 
     289if (isset ($_REQUEST["form_request"]) && $_REQUEST["form_request"] == "login") { 
     290    $username = trim($_REQUEST['username']); 
     291        if (strpos($username, "@") === false) 
     292                $smarty->assign('username', $username); 
     293        else { 
     294                $email = $username; 
     295                $username = ""; 
     296                $smarty->assign('email', $email); 
     297        } 
     298} 
    278299 
    279300// Set section of Smarty template 
  • trunk/wifidog-auth/wifidog/templates/change_password.html

    r743 r1018  
    11<fieldset class="pretty_fieldset"> 
    22<legend>{"Change my password"|_}</legend> 
    3  
    4         <form name="form" method="post"> 
    5         <table> 
     3    <form name="form" method="post" onsubmit="return false" action="{$base_ssl_path}change_password.php"> 
     4        <input type="hidden" name="form_request" value="change_password"> 
     5    <table> 
    66        {if $SelectNetworkUI} 
    77        {$SelectNetworkUI} 
    88        {/if} 
    9         <tr> 
    10             <td>{"Your username"|_}:</td> 
    11             <td><input type="text" name="username" value="{$username}" size="20"></td> 
    12         </tr> 
    13         <tr> 
    14             <td>{"Your current password"|_}:</td> 
    15             <td><input type="password" name="oldpassword" value="{$oldpassword}" size="20"></td> 
    16         </tr> 
    17         <tr> 
    18             <td>{"Your new password"|_}:</td> 
    19             <td><input type="password" name="newpassword" value="{$newpassword}" size="20"></td> 
    20         </tr> 
    21         <tr> 
    22             <td>{"Your new password"|_} {"(again)"|_}:</td> 
    23             <td><input type="password" name="newpassword_again" value="{$newpassword_again}" size="20"></td> 
    24         </tr> 
    25         <tr> 
    26             <td></td> 
    27             <td><input class="submit" type="submit" name="submit" value="{"Change my password"|_}"></td> 
    28         </tr> 
    29         </table> 
    30         </form> 
    31  
     9    <tr> 
     10        <td>{"Your username"|_}:</td> 
     11        <td><input type="text" name="username" value="{$username}" size="20" id="form_username" onkeypress="return focusNext(this.form, 'oldpassword', event)"{if !$isSuperAdmin} readonly{/if}></td> 
     12    </tr> 
     13    <tr> 
     14        <td>{"Your current password"|_}:</td> 
     15        <td><input type="password" name="oldpassword" value="{$oldpassword}" size="20" id="form_oldpassword" onkeypress="return focusNext(this.form, 'newpassword', event)"></td> 
     16    </tr> 
     17    <tr> 
     18        <td>{"Your new password"|_}:</td> 
     19        <td><input type="password" name="newpassword" value="{$newpassword}" size="20" onkeypress="return focusNext(this.form, 'newpassword_again', event)"></td> 
     20    </tr> 
     21    <tr> 
     22        <td>{"Your new password"|_} {"(again)"|_}:</td> 
     23        <td><input type="password" name="newpassword_again" value="{$newpassword_again}" size="20" onkeypress="return focusNext(this.form, 'form_submit', event)"></td> 
     24    </tr> 
     25    <tr> 
     26        <td></td> 
     27        <td><input class="submit" type="submit" name="form_submit" value="{"Change my password"|_}" onclick="if (validateForm(this.form)) this.form.submit()"></td> 
     28    </tr> 
     29    </table> 
     30    </form> 
    3231</fieldset> 
    3332     
    34     <div id="help"> 
    35         {if $error} 
    36         {$error} 
    37         {else} 
    38         {"Please enter your current username, your current password, and your new password (with confirmation)"|_}. 
    39         {/if} 
    40     </div> 
     33<div id="help"> 
     34        {"Please enter your current username, your current password, and your new password (with confirmation)"|_}. 
     35</div> 
     36 
     37<div id="form_errormsg" class="errormsg"> 
     38        {if $error} 
     39        {$error} 
     40        {/if} 
     41</div> 
     42 
     43<script type="text/javascript"> 
     44        <!-- 
     45        {literal} 
     46        var messages = { 
     47        {/literal} 
     48          empty_form: "{"You must specify your username and password"|_}", 
     49          username_required: "{'Username is required.'|_}", 
     50          username_invalid: "{'Username contains invalid characters.'|_}", 
     51          password_empty: "{'A password of at least 6 characters is required.'|_}", 
     52          password_invalid: "{'Password contains invalid characters.'|_}", 
     53          password_short: "{'Password is too short, it must be 6 characters minimum'|_}", 
     54          password_twice: "{'You must type your password twice.'|_}", 
     55          password_match: "{'Passwords do not match.'|_}" 
     56        {literal} 
     57        }; 
     58 
     59        {/literal} 
     60        {if $isSuperAdmin} 
     61        document.getElementById("form_username").focus(); 
     62        {else} 
     63        document.getElementById("form_oldpassword").focus(); 
     64        {/if} 
     65        {literal} 
     66 
     67        function validateForm(form) { 
     68          if (!isValidUsername(form.username)) { 
     69                if (isEmpty(form.username)) 
     70                  document.getElementById("form_errormsg").innerHTML = messages.username_required; 
     71                else 
     72                  document.getElementById("form_errormsg").innerHTML = messages.username_invalid; 
     73 
     74                focusElement(form.name, 'username'); 
     75 
     76                return false; 
     77          } 
     78 
     79          if (!isValidPassword(form.oldpassword)) { 
     80                if (isEmpty(form.oldpassword)) 
     81                  document.getElementById("form_errormsg").innerHTML = messages.password_empty; 
     82                else if (form.oldpassword.value.length<6) 
     83                  document.getElementById("form_errormsg").innerHTML = messages.password_short; 
     84                else 
     85                  document.getElementById("form_errormsg").innerHTML = messages.password_invalid; 
     86 
     87                focusElement(form.name, 'oldpassword'); 
     88 
     89                return false; 
     90          } 
     91 
     92          if (!isValidPassword(form.newpassword)) { 
     93                if (isEmpty(form.newpassword)) 
     94                  document.getElementById("form_errormsg").innerHTML = messages.password_empty; 
     95                else if (form.newpassword.value.length<6) 
     96                  document.getElementById("form_errormsg").innerHTML = messages.password_short; 
     97                else 
     98                  document.getElementById("form_errormsg").innerHTML = messages.password_invalid; 
     99 
     100                focusElement(form.name, 'newpassword'); 
     101 
     102                return false; 
     103          } 
     104 
     105          if (isEmpty(form.newpassword_again)) { 
     106                document.getElementById("form_errormsg").innerHTML = messages.password_twice; 
     107                focusElement(form.name, 'newpassword_again'); 
     108                return false; 
     109          } 
     110 
     111          if (form.newpassword.value != form.newpassword_again.value) { 
     112                document.getElementById("form_errormsg").innerHTML = messages.password_match; 
     113                focusElement(form.name, 'newpassword_again'); 
     114                return false; 
     115          } 
     116 
     117          return true; 
     118        } 
     119 
     120        {/literal} 
     121        //--> 
     122</script> 
  • trunk/wifidog-auth/wifidog/templates/classes/MainUI_Display.tpl

    r1012 r1018  
    6060 
    6161                <link rel="stylesheet" type="text/css" href="{$stylesheetURL}"> 
     62                <script src="{$system_path}js/formutils.js"></script> 
    6263 
    6364        <style type="text/css"> 
     
    7172            {if $debugRequested} 
    7273                <pre>{$debugOutput}</pre> 
     74                {/if} 
     75                        {if !empty($contentArray.page_header)} 
     76                                {$contentArray.page_header} 
    7377                {/if} 
    7478                </div> 
  • trunk/wifidog-auth/wifidog/templates/classes/MainUI_ToolContent.tpl

    r1009 r1018  
    5555                {if $isValidUser} 
    5656                    <p>{"Logged in as"|_}: {$username}</p> 
    57                     <a class="administration" href="{$base_ssl_path}user_profile.php"><img class="administration" src="{$base_ssl_path}images/profile.gif" border="0">{"My Profile"|_}</a> 
    58                     <a class="administration" href="{$base_ssl_path}login/?logout=true{$logoutParameters}"><img class="administration" src="{$base_ssl_path}images/logout.gif" border="0">{"Logout"|_}</a> 
     57                    <a class="administration" href="{$system_path}user_profile.php"><img class="administration" src="{$system_path}images/profile.gif">{"My Profile"|_}</a> 
     58                    <a class="administration" href="{$system_path}login/?logout=true{$logoutParameters}"><img class="administration" src="{$system_path}images/logout.gif">{"Logout"|_}</a> 
    5959                {else} 
     60                                        {if !$shrinkLeftArea} 
    6061                    <p> 
    6162                        {"I am not logged in."|_}<br> 
    62                         <a href="{$base_ssl_path}login/{$loginParameters}">{"Login"|_}</a> 
     63                        <a href="{$system_path}login/{$loginParameters}">{"Login"|_}</a> 
    6364                    </p> 
     65                                        {/if} 
    6466 
    65                     <a class="administration" href="{$networkHomepageURL}"><img class="administration" src="{$base_url_path}images/lien_ext.gif">{$networkName}</a> 
    66                     <a class="administration" href="{$base_ssl_path}faq.php"><img class="administration" src="{$base_url_path}images/where.gif">{"Where am I?"|_}</a> 
     67                    <a class="administration" href="{$networkHomepageURL}"><img class="administration" src="{$system_path}images/lien_ext.gif">{$networkName}</a> 
     68                    <a class="administration" href="{$system_path}faq.php"><img class="administration" src="{$system_path}images/where.gif">{"Where am I?"|_}</a> 
    6769                {/if} 
    6870            </span> 
     
    8890        </div> 
    8991 
     92                {if !$shrinkLeftArea} 
    9093        <div class="avis"> 
    9194            <span class="avis"> 
     
    9497            </span> 
    9598        </div> 
     99                {/if} 
    96100{* 
    97101    END section START 
  • trunk/wifidog-auth/wifidog/templates/classes/MainUI_ToolSection.tpl

    r974 r1018  
    5757                <div class="admin_section_data"> 
    5858                    <ul> 
    59                         <li><a href="{$base_ssl_path}admin/user_log.php">{"User logs"|_}</a></li> 
    60                         <li><a href="{$base_ssl_path}admin/online_users.php">{"Online Users"|_}</a></li> 
    61                         <li><a href="{$base_ssl_path}admin/stats.php">{"Statistics"|_}</a></li> 
    62                         <li><a href="{$base_ssl_path}admin/import_user_database.php">{"Import NoCat user database"|_}</a></li> 
     59                        <li><a href="{$system_path}admin/user_log.php">{"User logs"|_}</a></li> 
     60                        <li><a href="{$system_path}admin/online_users.php">{"Online Users"|_}</a></li> 
     61                        <li><a href="{$system_path}admin/stats.php">{"Statistics"|_}</a></li> 
     62                        <li><a href="{$system_path}admin/import_user_database.php">{"Import NoCat user database"|_}</a></li> 
    6363                    </ul> 
    6464                </div> 
     
    8787                <div class="admin_section_data"> 
    8888                    <ul> 
    89                         <li><a href="{$base_ssl_path}admin/generic_object_admin.php?object_class=Node&action=list">{"Nodes"|_}</a></li> 
    90                         <li><a href="{$base_ssl_path}admin/generic_object_admin.php?object_class=Node&action=new_ui">{"Add new Node"|_}</a></li> 
     89                        <li><a href="{$system_path}admin/generic_object_admin.php?object_class=Node&action=list">{"Nodes"|_}</a></li> 
     90                        <li><a href="{$system_path}admin/generic_object_admin.php?object_class=Node&action=new_ui">{"Add new Node"|_}</a></li> 
    9191                    </ul> 
    9292                </div> 
     
    100100                <div class="admin_section_data"> 
    101101                    <ul> 
    102                         <li><a href="{$base_ssl_path}admin/generic_object_admin.php?object_class=Network&action=list">{"Networks"|_}</a></li> 
     102                        <li><a href="{$system_path}admin/generic_object_admin.php?object_class=Network&action=list">{"Networks"|_}</a></li> 
    103103                    </ul> 
    104104                </div> 
     
    110110                <div class="admin_section_data"> 
    111111                    <ul> 
    112                         <li><a href="{$base_ssl_path}admin/generic_object_admin.php?object_class=Server&action=list">{"Servers"|_}</a></li> 
    113                         <li><a href="{$base_ssl_path}admin/generic_object_admin.php?object_class=Content&action=list">{"Content"|_}</a></li> 
     112                        <li><a href="{$system_path}admin/generic_object_admin.php?object_class=Server&action=list">{"Servers"|_}</a></li> 
     113                        <li><a href="{$system_path}admin/generic_object_admin.php?object_class=Content&action=list">{"Content"|_}</a></li> 
    114114                    </ul> 
    115115                </div> 
  • trunk/wifidog-auth/wifidog/templates/sites/index.tpl

    r1005 r1018  
    5353    <div id="login_form"> 
    5454        <ul> 
    55             <li><a href="{$base_ssl_path}change_password.php">{"Change password"|_}</a></li> 
    56             <li><a href="{$base_ssl_path}faq.php">{"I have trouble connecting and I would like some help"|_}</a></li> 
     55                        {if $isValidUser} 
     56            <li><a href="{$system_path}change_password.php">{"Change password"|_}</a></li> 
     57                        {else} 
     58            <li><a href="{$system_path}faq.php">{"I have trouble connecting and I would like some help"|_}</a></li> 
     59                        {/if} 
    5760        </ul> 
    5861    </div> 
     
    99102    <ul> 
    100103        {if $googleMapsEnabled && !$userIsAtHotspot} 
    101             <li><a href="{$base_non_ssl_path}hotspots_map.php">{"Deployed HotSpots map"|_}</a></li> 
     104            <li><a href="{$system_path}hotspots_map.php">{"Deployed HotSpots map"|_}</a></li> 
    102105        {/if} 
    103         <li><a href="{$base_ssl_path}hotspot_status.php">{"Deployed HotSpots status with coordinates"|_}</a></li> 
    104         <li><a href="{$base_ssl_path}node_list.php">{"Full node technical status (includes non-deployed nodes)"|_}</a></li> 
    105         <li><a href="{$base_ssl_path}admin/index.php">{"Administration"|_}</a></li> 
     106        <li><a href="{$system_path}hotspot_status.php">{"Deployed HotSpots status with coordinates"|_}</a></li> 
     107        <li><a href="{$system_path}node_list.php">{"Full node technical status (includes non-deployed nodes)"|_}</a></li> 
     108        <li><a href="{$system_path}admin/index.php">{"Administration"|_}</a></li> 
    106109    </ul> 
    107110{* 
  • trunk/wifidog-auth/wifidog/templates/sites/login.tpl

    r1009 r1018  
    4848 
    4949    <div id="login_form"> 
    50         <h1><a href="{$base_ssl_path}signup.php">{"Create a free account"|_}</a></h1> 
    51  
    52         <h1>{"I already have an account"|_}:</h1> 
     50        <h1>{"Login or Signup here"|_}:</h1> 
    5351 
    5452        <p class="indent"> 
    55             <form name="login_form" method="post"> 
     53            <form name="login_form" method="post" onsubmit="return false" action="{$base_ssl_path}login/index.php"> 
     54                        <input type="hidden" name="form_request" value="login"> 
    5655                {if $node != null} 
    5756                    <input type="hidden" name="gw_address" value="{$gw_address}"> 
     
    6665 
    6766                {"Username (or email)"|_}:<br> 
    68                 <input type="text" name="username" value="{$username}" size="20" id="form_username"><br> 
     67                <input type="text" name="username" value="{$username}" size="20" id="form_username" onkeypress="return focusNext(this.form, 'password', event)"><br> 
    6968                {"Password"|_}:<br> 
    70                 <input type="password" name="password" size="20"><br> 
     69                <input type="password" name="password" size="20" id="form_password" onkeypress="return focusNext(this.form, 'form_submit', event)"><br> 
    7170 
    72                 {if $error != null} 
    73                     <div class="errormsg">{$error}</div> 
    74                 {/if} 
     71                <div id="form_errormsg" class="errormsg"> 
     72                                {if $error == null} 
     73                                  &nbsp; 
     74                                {else} 
     75                                  {$error} 
     76                                {/if} 
     77                                </div> 
    7578 
    76                 <input class="submit" type="submit" name="submit" value="{"Login"|_}"> 
     79                <input class="submit" type="button" name="form_submit" value="{"Login"|_}" onclick="if (validateForm(this.form)) this.form.submit()"> 
     80                                &nbsp; 
     81                <input class="submit" type="button" name="form_signup" value="{$create_a_free_account}" onclick="this.form.action='{$base_ssl_path}signup.php'; this.form.submit()"> 
    7782            </form> 
    7883        </p> 
     84 
     85                <div id="help"> 
     86                {"You must specify your username and password"|_}. 
     87                </div> 
    7988 
    8089        <h1>{"I'm having difficulties"|_}:</h1> 
    8190 
    8291        <ul> 
    83             <li><a href="{$base_ssl_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
    84             <li><a href="{$base_ssl_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
    85             <li><a href="{$base_ssl_path}resend_validation.php">{"Re-send the validation email"|_}</a></li> 
    86             <li><a href="{$base_ssl_path}faq.php">{"Frequently asked questions"|_}</a></li> 
     92            <li><a href="{$system_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
     93            <li><a href="{$system_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
     94            <li><a href="{$system_path}resend_validation.php">{"Re-send the validation email"|_}</a></li> 
     95            <li><a href="{$system_path}faq.php">{"Frequently asked questions"|_}</a></li> 
    8796        </ul> 
    8897    </div> 
     
    9099    <script type="text/javascript"> 
    91100        <!-- 
    92             document.getElementById("form_username").focus(); 
     101                {literal} 
     102                var messages = { 
     103                {/literal} 
     104                  empty_form: "{"You must specify your username and password"|_}", 
     105                  username_required: "{'Username is required.'|_}", 
     106                  username_invalid: "{'Username contains invalid characters.'|_}", 
     107                  email_invalid: "{'A valid email address is required.'|_}", 
     108                  password_empty: "{'A password of at least 6 characters is required.'|_}", 
     109                  password_invalid: "{'Password contains invalid characters.'|_}", 
     110                  password_short: "{'Password is too short, it must be 6 characters minimum'|_}" 
     111                {literal} 
     112                }; 
     113 
     114                document.getElementById("form_username").focus(); 
     115 
     116                function validateForm(form) { 
     117                  if (!isValidUsername(form.username)) { 
     118                        if (isEmpty(form.username)) { 
     119                          document.getElementById("form_errormsg").innerHTML = messages.username_required; 
     120                          return false; 
     121                        } 
     122                        else { 
     123                          if (!isValidEmail(form.username)) { 
     124                                document.getElementById("form_errormsg").innerHTML = messages.username_invalid; 
     125                                return false; 
     126                          } 
     127                        } 
     128                  } 
     129 
     130                  if (!isValidPassword(form.password)) { 
     131                        if (isEmpty(form.password)) 
     132                          document.getElementById("form_errormsg").innerHTML = messages.password_empty; 
     133                        else if (form.password.value.length<6) 
     134                          document.getElementById("form_errormsg").innerHTML = messages.password_short; 
     135                        else 
     136                          document.getElementById("form_errormsg").innerHTML = messages.password_invalid; 
     137 
     138                        return false; 
     139                  } 
     140 
     141                  return true; 
     142                } 
     143 
     144                {/literal} 
    93145        //--> 
    94146    </script> 
  • trunk/wifidog-auth/wifidog/templates/sites/lost_password.tpl

    r959 r1018  
    5959 
    6060        <ul> 
    61             <li><a href="{$base_ssl_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
    62             <li><a href="{$base_ssl_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
    63             <li><a href="{$base_ssl_path}resend_validation.php">{"Re-send the validation email"|_}</a></li> 
    64             <li><a href="{$base_ssl_path}faq.php">{"Frequently asked questions"|_}</a></li> 
     61            <li><a href="{$system_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
     62            <li><a href="{$system_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
     63            <li><a href="{$system_path}resend_validation.php">{"Re-send the validation email"|_}</a></li> 
     64            <li><a href="{$system_path}faq.php">{"Frequently asked questions"|_}</a></li> 
    6565        </ul> 
    6666    </div> 
     
    7777       <legend>{"Lost password"|_}</legend> 
    7878 
    79         <form name="form" method="post"> 
     79        <form name="form" method="post" onsubmit="return false" action="{$base_ssl_path}lost_password.php"> 
     80                <input type="hidden" name="form_request" value="lost_password"> 
    8081            {if $SelectNetworkUI} 
    8182                {$SelectNetworkUI} 
     
    8586                <tr> 
    8687                    <th>{"Your username"|_}:</th> 
    87                     <td><input type="text" name="username" value="{$username}" size="20" id="form_username"></td> 
     88                    <td><input type="text" name="username" value="{$username}" size="20" id="form_username" onkeypress="return focusNext(this.form, 'email', event)"></td> 
    8889                </tr> 
    8990                <tr> 
    9091                    <th>{"Your email address"|_}:</th> 
    91                     <td><input type="text" name="email" value="{$email}" size="20"></td> 
     92                    <td><input type="text" name="email" value="{$email}" size="20" onkeypress="return focusNext(this.form, 'form_submit', event)"></td> 
    9293                </tr> 
    9394                <tr> 
    9495                    <th></th> 
    95                     <td><input class="submit" type="submit" name="submit" value="{"Reset my password"|_}"></td> 
     96                    <td><input class="submit" type="submit" name="form_submit" value="{"Reset my password"|_}" onclick="if (validateForm(this.form)) this.form.submit()"></td> 
    9697                </tr> 
    9798            </table> 
     
    100101 
    101102    <div id="help"> 
    102         {if $error} 
    103             <div class="errormsg">{$error}</div> 
    104         {else} 
    105             {"Please enter your username or email address to reset your password"|_}. 
    106         {/if} 
     103    {"Please enter your username or email address to reset your password"|_}. 
    107104    </div> 
    108105 
     106    <div id="form_errormsg" class="errormsg"> 
     107    {if $error} 
     108                {$error} 
     109        {/if} 
     110        </div> 
     111 
    109112    <script type="text/javascript"> 
    110         <!-- 
    111             document.getElementById("form_username").focus(); 
    112         //--> 
     113    <!-- 
     114        {literal} 
     115                var messages = { 
     116        {/literal} 
     117                  username_required: "{'Please specify a username or email address'|_}", 
     118                  username_invalid: "{'Username contains invalid characters.'|_}", 
     119                  email_invalid: "{'The email address must be valid (i.e. user@domain.com). Please understand that we also black-listed various temporary-email-address providers.'|_}" 
     120        {literal} 
     121                }; 
     122 
     123        document.getElementById("form_username").focus(); 
     124 
     125                function validateForm(form) { 
     126                  if (!isValidUsername(form.username)) { 
     127                        if (isEmpty(form.username)) { 
     128                          if (isEmpty(form.email)) { 
     129                                // username and email cannot both be empty 
     130                                document.getElementById("form_errormsg").innerHTML = messages.username_required; 
     131                                return false; 
     132                          } 
     133                        } 
     134                        else { 
     135                          document.getElementById("form_errormsg").innerHTML = messages.username_invalid; 
     136                          return false; 
     137                        } 
     138                  } 
     139 
     140                  if (!isValidEmail(form.email)) { 
     141                        if (isNotEmpty(form.email)) { 
     142                          document.getElementById("form_errormsg").innerHTML = messages.email_invalid; 
     143                          return false; 
     144                        } 
     145                        else if (isEmpty(form.username)) { 
     146                          // username and email cannot both be empty 
     147                          document.getElementById("form_errormsg").innerHTML = messages.username_required; 
     148                          return false; 
     149                        } 
     150                  } 
     151 
     152                  return true; 
     153                } 
     154 
     155                {/literal} 
     156    //--> 
    113157    </script> 
    114158{* 
  • trunk/wifidog-auth/wifidog/templates/sites/lost_username.tpl

    r958 r1018  
    5959 
    6060        <ul> 
    61             <li><a href="{$base_ssl_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
    62             <li><a href="{$base_ssl_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
    63             <li><a href="{$base_ssl_path}resend_validation.php">{"Re-send the validation email"|_}</a></li> 
    64             <li><a href="{$base_ssl_path}faq.php">{"Frequently asked questions"|_}</a></li> 
     61            <li><a href="{$system_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
     62            <li><a href="{$system_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
     63            <li><a href="{$system_path}resend_validation.php">{"Re-send the validation email"|_}</a></li> 
     64            <li><a href="{$system_path}faq.php">{"Frequently asked questions"|_}</a></li> 
    6565        </ul> 
    6666    </div> 
     
    7777        <legend>{"Lost username"|_}</legend> 
    7878 
    79         <form name="form" method="post"> 
     79        <form name="form" method="post" onsubmit="return false" action="{$base_ssl_path}lost_username.php"> 
     80                <input type="hidden" name="form_request" value="lost_username"> 
    8081            {if $SelectNetworkUI} 
    8182            {$SelectNetworkUI} 
     
    8586                <tr> 
    8687                    <th>{"Your email address"|_}:</th> 
    87                     <td><input type="text" name="email" value="{$email}" size="20" id="form_email"></td> 
     88                    <td><input type="text" name="email" value="{$email}" size="20" id="form_email" onkeypress="return focusNext(this.form, 'form_submit', event)"></td> 
    8889                </tr> 
    8990                <tr> 
    9091                    <th></th> 
    91                     <td><input class="submit" type="submit" name="submit" value="{"Retrieve"|_}"></td> 
     92                    <td><input class="submit" type="submit" name="form_submit" value="{"Retrieve"|_}" onclick="if (validateForm(this.form)) this.form.submit()"></td> 
    9293                </tr> 
    9394            </table> 
     
    9697 
    9798    <div id="help"> 
    98         {if $error} 
    99             <div class="errormsg">{$error}</div> 
    100         {else} 
    101             {"Please enter your email address to recover your username"|_}. 
    102         {/if} 
     99                {"Please enter your email address to recover your username"|_}. 
    103100    </div> 
    104101 
     102        <div id="form_errormsg" class="errormsg"> 
     103        {if $error} 
     104                {$error} 
     105        {/if} 
     106        </div> 
     107 
    105108    <script type="text/javascript"> 
    106         <!-- 
    107             document.getElementById("form_email").focus(); 
    108         //--> 
     109    <!-- 
     110        {literal} 
     111                var messages = { 
     112        {/literal} 
     113                  email_required: "{'Please specify an email address.'|_}", 
     114                  email_invalid: "{'The email address must be valid (i.e. user@domain.com). Please understand that we also black-listed various temporary-email-address providers.'|_}", 
     115        {literal} 
     116                }; 
     117 
     118        document.getElementById("form_email").focus(); 
     119 
     120                function validateForm(form) { 
     121                  if (!isValidEmail(form.email)) { 
     122                        if (isEmpty(form.email)) 
     123                          document.getElementById("form_errormsg").innerHTML = messages.email_required; 
     124                        else 
     125                          document.getElementById("form_errormsg").innerHTML = messages.email_invalid; 
     126                        return false; 
     127                  } 
     128 
     129                  return true; 
     130                } 
     131                {/literal} 
     132    //--> 
    109133    </script> 
    110134{* 
  • trunk/wifidog-auth/wifidog/templates/sites/resend_validation.tpl

    r962 r1018  
    5959 
    6060        <ul> 
    61             <li><a href="{$base_ssl_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
    62             <li><a href="{$base_ssl_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
    63             <li><a href="{$base_ssl_path}resend_validation.php">{"Re-send the validation email"|_}</a></li> 
    64             <li><a href="{$base_ssl_path}faq.php">{"Frequently asked questions"|_}</a></li> 
     61            <li><a href="{$system_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
     62            <li><a href="{$system_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
     63            <li><a href="{$system_path}resend_validation.php">{"Re-send the validation email"|_}</a></li> 
     64            <li><a href="{$system_path}faq.php">{"Frequently asked questions"|_}</a></li> 
    6565        </ul> 
    6666    </div> 
     
    7777        <legend>{"Re-send validation email"|_}</legend> 
    7878 
    79         <form name="form"> 
     79        <form name="form" method="post" onsubmit="return false" action="{$base_ssl_path}resend_validation.php"> 
     80                <input type="hidden" name="form_request" value="resend_validation"> 
    8081            {if $SelectNetworkUI} 
    8182                {$SelectNetworkUI} 
     
    8586                <tr> 
    8687                    <th>{"Your username"|_}:</th> 
    87                     <td><input type="text" name="username" value="{$username}" size="20" id="form_username"></td> 
     88                    <td><input type="text" name="username" value="{$username}" size="20" id="form_username" onkeypress="return focusNext(this.form, 'form_submit', event)"></td> 
    8889                </tr> 
    8990                <tr> 
    9091                    <th></th> 
    91                     <td><input class="submit" type="submit" name="submit" value="{"Re-send"|_}"></td> 
     92                    <td><input class="submit" type="submit" name="form_submit" value="{"Re-send"|_}" onclick="if (validateForm(this.form)) this.form.submit()"></td> 
    9293                </tr> 
    9394            </table> 
     
    9697 
    9798    <div id="help"> 
    98         {if $error} 
    99             <div class="errormsg">{$error}</div> 
    100         {else} 
    101             {"Please enter your username and the validation email will be resent to your email address"|_}. 
    102         {/if} 
     99        {"Please enter your username and the validation email will be resent to your email address"|_}. 
    103100    </div> 
    104101 
     102        <div id="form_errormsg" class="errormsg"> 
     103        {if $error} 
     104                {$error} 
     105        {/if} 
     106        </div> 
     107 
    105108    <script type="text/javascript"> 
    106         <!-- 
    107             document.getElementById("form_username").focus(); 
    108         //--> 
     109        <!-- 
     110        {literal} 
     111                var messages = { 
     112        {/literal} 
     113                  username_required: "{'Username is required.'|_}", 
     114                  username_invalid: "{'Username contains invalid characters.'|_}", 
     115        {literal} 
     116                }; 
     117 
     118                document.getElementById("form_username").focus(); 
     119 
     120                function validateForm(form) { 
     121                  if (!isValidUsername(form.username)) { 
     122                        if (isEmpty(form.username)) 
     123                          document.getElementById("form_errormsg").innerHTML = messages.username_required; 
     124                        else 
     125                          document.getElementById("form_errormsg").innerHTML = messages.username_invalid; 
     126 
     127                        return false; 
     128                  } 
     129 
     130                  return true; 
     131                } 
     132                {/literal} 
     133        //--> 
    109134    </script> 
    110135{* 
  • trunk/wifidog-auth/wifidog/templates/sites/signup.tpl

    r955 r1018  
    3535 
    3636/** 
    37  * Sign up page 
    38  * 
    39  * @package    WiFiDogAuthServer 
    40  * @subpackage Templates 
    41  * @author     Philippe April 
    42  * @author     Benoit Gregoire <bock@step.polymtl.ca> 
    43  * @author     Max Horvath <max.horvath@maxspot.de> 
    44  * @copyright  2004-2006 Philippe April 
    45  * @copyright  2004-2006 Benoit Gregoire, Technologies Coeus inc. 
    46  * @copyright  2006 Max Horvath, maxspot GmbH 
    47  * @version    Subversion $Id$ 
    48  * @link       http://www.wifidog.org/ 
    49  */ 
     37* Sign up page 
     38* 
     39* @package    WiFiDogAuthServer 
     40* @subpackage Templates 
     41* @author     Philippe April 
     42* @author     Benoit Gregoire <bock@step.polymtl.ca> 
     43* @author     Max Horvath <max.horvath@maxspot.de> 
     44* @copyright  2004-2006 Philippe April 
     45* @copyright  2004-2006 Benoit Gregoire, Technologies Coeus inc. 
     46* @copyright  2006 Max Horvath, maxspot GmbH 
     47* @version    Subversion $Id$ 
     48* @link       http://www.wifidog.org/ 
     49*/ 
    5050 
    5151*} 
     
    5353{if $sectionTOOLCONTENT} 
    5454{* 
    55     BEGIN section TOOLCONTENT 
    56 *} 
    57     <div id="login_form"> 
    58         <h1>{"I'm having difficulties"|_}:</h1> 
    59  
     55BEGIN section TOOLCONTENT 
     56*} 
     57<div id="login_form"> 
     58        <h1>{"I'm having difficulties"|_}:</h1> 
     59 
     60        <ul> 
     61                <li><a href="{$system_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
     62                <li><a href="{$system_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
     63                <li><a href="{$system_path}resend_validation.php">{"Re-send the validation email"|_}</a></li> 
     64                <li><a href="{$system_path}faq.php">{"Frequently asked questions"|_}</a></li> 
     65        </ul> 
     66</div> 
     67{* 
     68END section TOOLCONTENT 
     69*} 
     70{/if} 
     71 
     72{if $sectionMAINCONTENT} 
     73{* 
     74BEGIN section MAINCONTENT 
     75*} 
     76<fieldset class="pretty_fieldset"> 
     77        <legend>{"Register a free account with"|_} {$hotspot_network_name}</legend> 
     78 
     79        <form name="signup_form" method="post" onsubmit="return false" action="{$base_ssl_path}signup.php"> 
     80        <input type="hidden" name="form_request" value="signup"> 
     81                {if $SelectNetworkUI} 
     82                        {$SelectNetworkUI} 
     83                {/if} 
     84 
     85                <table> 
     86                        <tr> 
     87                                <th>{"Username desired"|_}:</th> 
     88                                <td><input type="text" name="username" value="{$username}" size="30" id="form_username" onkeypress="return focusNext(this.form, 'email', event)"></td> 
     89                        </tr> 
     90                        <tr> 
     91                                <th>{"Your email address"|_}:</th> 
     92                                <td><input type="text" name="email" value="{$email}" size="30" onkeypress="return focusNext(this.form, 'password', event)"></td> 
     93                        </tr> 
     94                        <tr> 
     95                                <th>{"Password"|_}:</th> 
     96                                <td><input type="password" name="password" size="30" onkeypress="return focusNext(this.form, 'password_again', event)"></td> 
     97                        </tr> 
     98            <tr> 
     99                <th>{"Password (again)"|_}:</th> 
     100                <td><input type="password" name="password_again" size="30" onkeypress="return focusNext(this.form, 'form_submit', event)"></td> 
     101            </tr> 
     102            <tr> 
     103                <th></th> 
     104                <td><input class="submit" type="submit" name="form_submit" value="{"Sign-up"|_}" onclick="if (validateForm(this.form)) this.form.submit()"></td> 
     105            </tr> 
     106        </table> 
     107    </form> 
     108 
     109    <hr> 
     110 
     111    <p> 
     112        <b>{"Please note"|_}</b>: 
     113        {"While accounts are free, we <em>strongly</em> suggest that you use your previously created account if you have one."|_} 
     114    </p> 
     115 
     116        <p> 
     117        {"<b>Your email address must be valid</b> in order for your account to be activated."|_} 
     118                {"A validation email will be sent to that email address."|_} 
     119                {"To fully activate your account you must respond to that email."|_} 
     120        </p> 
     121 
     122    <p> 
     123        <b>{"Note to free web-based email users"|_}</b>: 
     124        {"Sometimes our validation email ends up in the 'spam' folder of some providers. If you have not received any email with the validation URL 5 minutes after submitting this form, please take a look in the spam folder."|_} 
     125    </p> 
     126 
     127    <p> 
     128        <b>{"You can also use the following links if you need help"|_}:</b> 
    60129        <ul> 
    61             <li><a href="{$base_ssl_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
    62             <li><a href="{$base_ssl_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
    63             <li><a href="{$base_ssl_path}resend_validation.php">{"Re-send the validation email"|_}</a></li> 
    64             <li><a href="{$base_ssl_path}faq.php">{"Frequently asked questions"|_}</a></li> 
     130            <li><a href="{$system_path}lost_username.php">{"I Forgot my username"|_}</a></li> 
     131            <li><a href="{$system_path}lost_password.php">{"I Forgot my password"|_}</a></li> 
    65132        </ul> 
    66     </div> 
    67 {* 
    68     END section TOOLCONTENT 
    69 *} 
    70 {/if} 
    71  
    72 {if $sectionMAINCONTENT} 
    73 {* 
    74     BEGIN section MAINCONTENT 
    75 *} 
    76     <fieldset class="pretty_fieldset"> 
    77         <legend>{"Register a free account with"|_} {$hotspot_network_name}</legend> 
    78  
    79         <form name="signup_form" method="post"> 
    80             {if $SelectNetworkUI} 
    81                 {$SelectNetworkUI} 
    82             {/if} 
    83  
    84             <table> 
    85                 <tr> 
    86                     <th>{"Username desired"|_}:</th> 
    87                     <td><input type="text" name="username" value="{$username}" size="30" id="form_username"></td> 
    88                 </tr> 
    89                 <tr> 
    90                     <th>{"Your email address"|_}:</th> 
    91                     <td><input type="text" name="email" value="{$email}" size="30"></td> 
    92                 </tr> 
    93                 <tr> 
    94                     <th>{"Password"|_}:</th> 
    95                     <td><input type="password" name="password" size="30"></td> 
    96                 </tr> 
    97                 <tr> 
    98                     <th>{"Password (again)"|_}:</th> 
    99                     <td><input type="password" name="password_again" size="30"></td> 
    100                 </tr> 
    101                 <tr> 
    102                     <th></th> 
    103                     <td><input class="submit" type="submit" name="submit" value="{"Sign-up"|_}"></td> 
    104                 </tr> 
    105             </table> 
    106         </form> 
    107  
    108         <hr> 
    109  
    110         <p> 
    111             <b>{"Please note"|_}</b>: 
    112             {"While accounts are free, we <em>strongly</em> suggest that you use your previously created account if you have one."|_} 
    113         </p> 
    114  
    115         <p> 
    116             <b>{"Note to free web-based email users"|_}</b>: 
    117             {"Sometimes our validation email ends up in the 'spam' folder of some providers. If you have not received any email with the validation URL 5 minutes after submitting this form, please take a look in the spam folder."|_} 
    118         </p> 
    119  
    120         <p> 
    121             <b>{"You can also use the following links if you need help"|_}:</b> 
    122             <ul> 
    123                 <li><a href="{$smarty.const.BASE_SSL_PATH}lost_username.php">{"I Forgot my username"|_}</a></li> 
    124                 <li><a href="{$smarty.const.BASE_SSL_PATH}lost_password.php">{"I Forgot my password"|_}</a></li> 
    125             </ul> 
    126         </p> 
    127     </fieldset> 
    128  
    129     <div id="help"> 
    130         {if $error} 
    131             <div class="errormsg">{$error}</div> 
    132         {else} 
    133             {"Your email address must be valid in order for your account to be activated"|_}. 
     133    </p> 
     134</fieldset> 
     135 
     136    <div id="form_errormsg" class="errormsg"> 
     137        {if $error != null} 
     138                  {$error} 
    134139        {/if} 
    135     </div> 
     140        </div> 
    136141 
    137142    <script type="text/javascript"> 
    138143        <!-- 
    139             document.getElementById("form_username").focus(); 
     144        {literal} 
     145                var messages = { 
     146        {/literal} 
     147                  username_required: "{'Username is required.'|_}", 
     148                  username_invalid: "{'Username contains invalid characters.'|_}", 
     149                  email_invalid: "{'The email address must be valid (i.e. user@domain.com). Please understand that we also black-listed various temporary-email-address providers.'|_}", 
     150                  password_empty: "{'A password of at least 6 characters is required.'|_}", 
     151                  password_invalid: "{'Password contains invalid characters.'|_}", 
     152                  password_twice: "{'You must type your password twice.'|_}", 
     153                  password_match: "{'Passwords do not match.'|_}", 
     154                  password_short: "{'Password is too short, it must be 6 characters minimum'|_}" 
     155        {literal} 
     156                }; 
     157 
     158        document.getElementById("form_username").focus(); 
     159 
     160                function validateForm(form) { 
     161                  if (!isValidUsername(form.username)) { 
     162                        if (isEmpty(form.username)) 
     163                          document.getElementById("form_errormsg").innerHTML = messages.username_required; 
     164                        else 
     165                          document.getElementById("form_errormsg").innerHTML = messages.username_invalid; 
     166 
     167                        return false; 
     168                  } 
     169 
     170                  if (!isValidEmail(form.email)) { 
     171                        document.getElementById("form_errormsg").innerHTML = messages.email_invalid; 
     172                        return false; 
     173                  } 
     174 
     175                  if (!isValidPassword(form.password)) { 
     176                        if (isEmpty(form.password)) 
     177                          document.getElementById("form_errormsg").innerHTML = messages.password_empty; 
     178                        else if (form.password.value.length<6) 
     179                          document.getElementById("form_errormsg").innerHTML = messages.password_short; 
     180                        else 
     181                          document.getElementById("form_errormsg").innerHTML = messages.password_invalid; 
     182 
     183                        return false; 
     184                  } 
     185 
     186                  if (isEmpty(form.password_again)) { 
     187                        document.getElementById("form_errormsg").innerHTML = messages.password_twice; 
     188                        focusElement(form.name, 'password_again'); 
     189                        return false; 
     190                  } 
     191 
     192                  if (form.password.value != form.password_again.value) { 
     193                        document.getElementById("form_errormsg").innerHTML = messages.password_match; 
     194                        focusElement(form.name, 'password_again'); 
     195                        return false; 
     196                  } 
     197 
     198                  return true; 
     199                } 
     200 
     201                {/literal} 
    140202        //--> 
    141203    </script>