Ignore:
Timestamp:
07/30/08 18:35:15 (4 years ago)
Author:
hverton
Message:

updated preliminary support for multiple authentication methods. Made it more modulair and flexible, so other methods can be added. Also the login panel is more user friendly now

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/administration/settings_security.php

    r1558 r1559  
    4444        $auth_local = $_POST['auth_method']{1} == "+" ? "1" : "0"; 
    4545        switch ($auth_method) { 
     46            case "0":   // Local only 
     47                $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = 'local' WHERE cfg_name = 'auth_type'"); 
     48                break; 
    4649            case "1":   // LDAP 
    4750                if ($auth_local) { 
     
    6063            case "3":   // OpenID 
    6164                if ($auth_local) { 
    62                     $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = 'openid,local' WHERE cfg_name = 'auth_type'"); 
     65                    $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = 'local,openid' WHERE cfg_name = 'auth_type'"); 
    6366                } else { 
    6467                    $result = dbquery("UPDATE ".$db_prefix."configuration SET cfg_value = 'openid' WHERE cfg_name = 'auth_type'"); 
     
    106109 
    107110// determine the auth_method defined 
    108 $auth_methods = explode(",",$settings2['auth_type'].","); 
    109 switch($auth_methods[0]) { 
    110     case "ldap": 
    111         $auth_method = 1; 
    112         break; 
    113     case "ad": 
    114         $auth_method = 2; 
    115         break; 
    116     case "openid": 
    117         $auth_method = 3; 
    118     case "local": 
    119         break; 
    120     default: 
    121         $auth_method = 0; 
     111$auth_methods = explode(",",$settings2['auth_type']); 
     112$auth_method = 0; 
     113$auth_local = false; 
     114foreach($auth_methods as $auth_method) { 
     115    switch($auth_method) { 
     116        case "ldap": 
     117            $auth_method = 1; 
     118            break; 
     119        case "ad": 
     120            $auth_method = 2; 
     121            break; 
     122        case "openid": 
     123            $auth_method = 3; 
     124        case "local": 
     125            $auth_local = true; 
     126            break; 
     127        default: 
     128            $auth_method = 0; 
     129    } 
    122130} 
    123 $variables['auth_method'] = $auth_method; 
    124131 
    125132// check if a local fallback is defined 
    126 if ($auth_method && $auth_methods[1] == "local") { 
    127     $variables['auth_method'] .= "+"; 
    128 } 
     133$variables['auth_method'] .= $auth_method . ($auth_local ? "+" : " "); 
    129134 
    130135// define the admin body panel 
Note: See TracChangeset for help on using the changeset viewer.