Ignore:
Timestamp:
12/07/08 22:05:25 (3 years ago)
Author:
WanWizard
Message:

the authentication system now uses templates for login pages, so a new authentication method can supply it's own template with fields required for login

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/authentication/authentication.php

    r2095 r2099  
    4545    // used to store the logon status code 
    4646    var $status = false; 
     47 
     48    // used to store the available logon templates 
     49    var $templates = array(); 
    4750 
    4851    // class constructor 
     
    139142 
    140143        // call the logoff function of the authentication method used 
    141         $this->classes[$this->method_used]->logoff(); 
     144        if ($this->method_used) { 
     145            $this->classes[$this->method_used]->logoff(); 
     146        } 
    142147 
    143148        // remove logon information from the session record 
     
    155160 
    156161        return $this->userrecord; 
     162    } 
     163 
     164    // get the list of templates 
     165    function get_templates($type = "side") { 
     166 
     167        // do we have them cached? 
     168        if (!isset($this->templates[$type]) || !is_array($this->templates[$type])) { 
     169            // define the array to store the templates for this type 
     170            $this->templates[$type] = array(); 
     171 
     172            // loop through the selected logon functions 
     173            foreach($this->selected as $method) { 
     174                // check if the class exists and is loaded 
     175                if (isset($this->methods[$method]) && is_object($this->classes[$method])) { 
     176                    // call the get_template function of the class 
     177                    $template = $this->classes[$method]->get_template($type); 
     178                    // do we already have this template 
     179                    if (!isset($this->templates[$type][$template])) { 
     180                        if (isset($_SESSION['box_login_'.$method])) { 
     181                            $state = $_SESSION['box_login_'.$method] == 0 ? 1 : 0; 
     182                        } else { 
     183                            $state = 1; 
     184                        } 
     185                        $this->templates[$type][$template] = array('method' => $method, 'state' => $state); 
     186                    } 
     187                } 
     188            } 
     189        } 
     190        // return the templates 
     191        return $this->templates[$type]; 
    157192    } 
    158193 
Note: See TracChangeset for help on using the changeset viewer.