1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 15:16:30 +02:00

Latest alt_auth update - thanks to Father B for more testing/debugging

This commit is contained in:
e107steved
2008-12-09 20:40:54 +00:00
parent 7dc939ab6e
commit ceaae186e6
20 changed files with 400 additions and 275 deletions

View File

@@ -1,10 +1,16 @@
<?php
if (!is_object($euf))
{
require_once(e_HANDLER.'user_extended_class.php');
$euf = new e107_user_extended;
}
define("AUTH_SUCCESS", -1);
define("AUTH_NOUSER", 1);
define("AUTH_BADPASSWORD", 2);
define("AUTH_NOCONNECT", 3);
define('AUTH_SUCCESS', -1);
define('AUTH_NOUSER', 1);
define('AUTH_BADPASSWORD', 2);
define('AUTH_NOCONNECT', 3);
define('AUTH_UNKNOWN', 4);
define('AUTH_NOT_AVAILABLE', 5);
@@ -50,7 +56,7 @@ function alt_auth_get_field_list($tableType, $frm, $parm, $asCheckboxes = FALSE)
$ret = '';
foreach ($alt_auth_user_fields as $f => $v)
{
if ($v[$tableType] == TRUE)
if (varsettrue($v['showAll']) || varsettrue($v[$tableType]))
{
$ret .= "<tr><td class='forumheader3'>";
if ($v['optional'] == FALSE) $ret .= '*&nbsp;';
@@ -87,7 +93,7 @@ function alt_auth_get_allowed_fields($tableType)
$ret = array();
foreach ($alt_auth_user_fields as $f => $v)
{
if ($v[$tableType] == TRUE)
if (varsettrue($v['showAll']) || varsettrue($v[$tableType]))
{
$fieldname = $tableType.'_'.$v['optname'];
$ret[$fieldname] = '1';
@@ -97,6 +103,29 @@ function alt_auth_get_allowed_fields($tableType)
}
function add_extended_fields()
{
global $alt_auth_user_fields, $euf, $pref;
if (!isset($pref['auth_extended'])) return;
if (!$pref['auth_extended']) return;
static $fieldsAdded = FALSE;
if ($fieldsAdded) return;
$xFields = $euf->user_extended_get_fieldList('','user_extended_struct_name');
// print_a($xFields);
$fields = explode(',',$pref['auth_extended']);
foreach ($fields as $f)
{
if (isset($xFields[$f]))
{
$alt_auth_user_fields['x_'.$f] = array('prompt' => varset($xFields[$f]['user_extended_struct_text'],'').' ('.$f.')',
'optname' => 'xf_x_'.$f,
'default' => varset($xFields[$f]['default'],''),
'optional' => TRUE,
'showAll' => TRUE );
}
}
$fieldsAdded = TRUE;
}
$common_fields = array(
@@ -135,7 +164,7 @@ function alt_auth_get_db_fields($prefix, $frm, $parm, $fields = 'server|uname|pw
// Write all the options to the DB. $prefix must NOT have trailing underscore
function alt_auth_post_options($prefix)
{
global $common_fields, $sql;
global $common_fields, $sql, $admin_log;
$lprefix = $prefix.'_';
$user_fields = alt_auth_get_allowed_fields($prefix); // Need this list in case checkboxes for parameters
@@ -164,6 +193,7 @@ function alt_auth_post_options($prefix)
}
}
}
$admin_log->log_event('AUTH_03',$prefix,E_LOG_INFORMATIVE,'');
return LAN_ALT_UPDATED;
}
@@ -174,7 +204,7 @@ function alt_auth_post_options($prefix)
function alt_auth_test_form($prefix,$frm)
{
$text = $frm -> form_open("post", e_SELF, 'testform');
$text .= "<table style='width:96%'>
$text .= "<table style='width:96%' class='fborder'>
<tr><td colspan='2' class='forumheader2' style='text-align:center;'>".LAN_ALT_42."</td></tr>";
if (isset($_POST['testauth']))

View File

@@ -11,31 +11,65 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/alt_auth_conf.php,v $
| $Revision: 1.1.1.1 $
| $Date: 2006-12-02 04:34:43 $
| $Author: mcfly_e107 $
| $Revision: 1.2 $
| $Date: 2008-12-09 20:40:54 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
$eplug_admin = true;
require_once("../../class2.php");
if(!getperms("P")){header("location:".e_BASE."index.php"); exit; }
require_once(e_HANDLER."form_handler.php");
require_once(e_ADMIN."auth.php");
include_lan(e_PLUGIN."alt_auth/languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
define("ALT_AUTH_ACTION", "main");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
require_once('../../class2.php');
if(!getperms("P")){header('location:'.e_BASE.'index.php'); exit; }
require_once(e_HANDLER.'form_handler.php');
require_once(e_ADMIN.'auth.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php');
define('ALT_AUTH_ACTION', 'main');
require_once(e_PLUGIN.'alt_auth/alt_auth_adminmenu.php');
require_once(e_HANDLER.'user_extended_class.php');
$euf = new e107_user_extended;
if(isset($_POST['updateprefs']))
{
$pref['auth_method'] = $_POST['auth_method'];
$pref['auth_noconn'] = intval($_POST['auth_noconn']);
$pref['auth_nouser'] = intval($_POST['auth_nouser']);
save_prefs();
header("location:".e_SELF);
exit;
unset($temp);
$temp['auth_method'] = $tp->toDB($_POST['auth_method']);
$temp['auth_noconn'] = intval($_POST['auth_noconn']);
$temp['auth_nouser'] = intval($_POST['auth_nouser']);
if ($admin_log->logArrayDiffs($temp, $pref, 'AUTH_01'))
{
save_prefs(); // Only save if changes
header("location:".e_SELF);
exit;
}
}
if(isset($_POST['updateeufs']))
{
$authExtended = array();
foreach ($_POST['auth_euf_include'] as $au)
{
$authExtended[] = trim($tp->toDB($au));
}
$au = implode(',',$authExtended);
if ($au != $pref['auth_extended'])
{
$pref['auth_extended'] = $au;
save_prefs();
$admin_log->log_event('AUTH_02',$au,'');
}
}
$authlist = alt_auth_get_authlist();
if (isset($pref['auth_extended']))
{
$authExtended = explode(',',$pref['auth_extended']);
}
else
{
$pref['auth_extended'] = '';
$authExtended = array();
}
$auth_dropdown = "<select class='tbox' name='auth_method'>\n";
foreach($authlist as $a)
@@ -91,7 +125,7 @@ $text .= "<option value='1' {$sel} >".LAN_ALT_FALLBACK."</option>
</tr>
<tr style='vertical-align:top'>
<td colspan='2' style='text-align:center' class='forumheader3'>
<td colspan='2' style='text-align:center' class='forumheader3'>
<br />
<input class='button' type='submit' name='updateprefs' value='".LAN_ALT_2."' />
</td>
@@ -104,6 +138,52 @@ $text .= "<option value='1' {$sel} >".LAN_ALT_FALLBACK."</option>
$ns -> tablerender("<div style='text-align:center'>".LAN_ALT_3."</div>", $text);
$extendedFields = $euf->user_extended_get_fields();
//print_a($extendedFields);
if (count($extendedFields))
{
$text = "<div style='text-align:center'>
<form method='post' action='".e_SELF."'>
<table style='width:95%' class='fborder' cellspacing='1' cellpadding='0'>
<colgroup>
<col style='width:10%' />
<col style='width:30%' />
<col style='width:40%' />
<col style='width:20%' />
</colgroup>\n";
foreach ($extendedFields as $p => $fl )
{
$text .= "<tr>
<td class='forumheader2'>".LAN_ALT_61."</td>
<td class='forumheader2'>".LAN_ALT_62."</td>
<td class='forumheader2'>".LAN_ALT_63."</td>
<td class='forumheader2'>".LAN_ALT_64."</td>
</tr>";
foreach ($fl as $f)
{
$checked = (in_array($f['user_extended_struct_name'], $authExtended) ? " checked='checked'" : '');
$text .= "<tr>
<td class='forumheader3'><input type='checkbox' name='auth_euf_include[]' value='{$f['user_extended_struct_name']}'{$checked} /></td>
<td class='forumheader3'>{$f['user_extended_struct_name']}</td>
<td class='forumheader3'>{$f['user_extended_struct_text']}</td>
<td class='forumheader3'>{$euf->user_extended_types[$f['user_extended_struct_type']]}</td></tr>\n";
}
}
$text .= "<tr style='vertical-align:top'>
<td colspan='4' class='forumheader3' style='text-align:center'>
<input class='button' type='submit' name='updateeufs' value='".LAN_ALT_2."' />
</td>
</tr>
</table>
</form>
</div>";
$ns -> tablerender("<div style='text-align:center'>".LAN_ALT_60."</div>", $text);
}
require_once(e_ADMIN."footer.php");
function alt_auth_conf_adminmenu()

View File

@@ -11,95 +11,148 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/alt_auth_login_class.php,v $
| $Revision: 1.4 $
| $Date: 2008-12-01 21:47:17 $
| $Revision: 1.5 $
| $Date: 2008-12-09 20:40:54 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
define('AA_DEBUG',FALSE);
class alt_login
{
function alt_login($method, &$username, &$userpass)
{
global $pref;
$newvals=array();
define("AUTH_SUCCESS", -1);
define("AUTH_NOUSER", 1);
define("AUTH_BADPASSWORD", 2);
define("AUTH_NOCONNECT", 3);
require_once(e_PLUGIN."alt_auth/".$method."_auth.php");
$_login = new auth_login;
global $pref, $admin_log;
$newvals=array();
define("AUTH_SUCCESS", -1);
define("AUTH_NOUSER", 1);
define("AUTH_BADPASSWORD", 2);
define("AUTH_NOCONNECT", 3);
require_once(e_PLUGIN."alt_auth/".$method."_auth.php");
$_login = new auth_login;
if(isset($_login->Available) && ($_login->Available === FALSE))
{ // Relevant auth method not available (e.g. PHP extension not loaded)
return AUTH_NOCONNECT;
}
$login_result = $_login -> login($username, $userpass, $newvals, FALSE);
if($login_result === AUTH_SUCCESS )
{
if (MAGIC_QUOTES_GPC == FALSE)
{
$username = mysql_real_escape_string($username);
if(isset($_login->Available) && ($_login->Available === FALSE))
{ // Relevant auth method not available (e.g. PHP extension not loaded)
return AUTH_NOCONNECT;
}
$username = preg_replace("/\sOR\s|\=|\#/", "", $username);
$username = substr($username, 0, varset($pref['loginname_maxlength'],30));
$aa_sql = new db;
$uh = new UserHandler;
$db_vals = array('user_password' => $aa_sql->escape($uh->HashPassword($userpass,$username)));
foreach ($newvals as $k => $v)
$login_result = $_login -> login($username, $userpass, $newvals, FALSE);
if($login_result === AUTH_SUCCESS )
{
if (strpos($k,'user_' !== 0)) $k = 'user_'.$k; // translate the field names (but latest handlers don't need translation)
$db_vals[$k] = $v;
}
if($aa_sql -> db_Select("user","*","user_loginname='{$username}' "))
{ // Existing user - get current data, see if any changes
$row = $aa_sql->db_Fetch();
foreach ($db_vals as $k => $v)
{
if ($row[$k] == $v) unset($db_vals[$k]);
}
if (count($db_vals)) $aa_sql->db_UpdateArray('user',$db_vals," WHERE `user_id`=".$row['user_id']);
if (MAGIC_QUOTES_GPC == FALSE)
{
$username = mysql_real_escape_string($username);
}
$username = preg_replace("/\sOR\s|\=|\#/", "", $username);
$username = substr($username, 0, varset($pref['loginname_maxlength'],30));
$aa_sql = new db;
$uh = new UserHandler;
$db_vals = array('user_password' => $aa_sql->escape($uh->HashPassword($userpass,$username)));
$xFields = array(); // Possible extended user fields
foreach ($newvals as $k => $v)
{
if (strpos($k,'x_') === 0)
{ // Extended field
$k = substr($k,2);
$xFields['user_'.$k] = $v;
}
else
{ // Normal user table
if (strpos($k,'user_' !== 0)) $k = 'user_'.$k; // translate the field names (but latest handlers don't need translation)
$db_vals[$k] = $v;
}
}
if (count($xFields))
{
// $qry = "SELECT u.*, ue.* FROM `#user` AS u
$qry = "SELECT u.user_id,u.".implode(',u.',array_keys($db_vals)).", ue.".implode(',ue.',array_keys($xFields))." FROM `#user` AS u
LEFT JOIN `#user_extended` AS ue ON ue.user_extended_id = u.user_id
WHERE u.user_loginname='{$username}' ";
if (AA_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","Query: {$qry}[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
}
else
{
$qry = "SELECT * FROM `#user` WHERE `user_loginname`='{$username}'";
}
// echo "Query: {$qry}<br />";
// if($aa_sql -> db_Select("user","*","user_loginname='{$username}' "))
if($aa_sql -> db_Select_gen($qry))
{ // Existing user - get current data, see if any changes
$row = $aa_sql->db_Fetch(MYSQL_ASSOC);
foreach ($db_vals as $k => $v)
{
if ($row[$k] == $v) unset($db_vals[$k]);
}
if (count($db_vals))
{
$aa_sql->db_UpdateArray('user',$db_vals," WHERE `user_id`=".$row['user_id']);
}
foreach ($xFields as $k => $v)
{
if ($row[$k] == $v) unset($xFields[$k]);
}
if (AA_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","User data read: ".print_r($row,TRUE)."[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
if (count($xFields))
{
if ($row['user_extended_id'])
{
if (AA_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","Update existing extended record",FALSE,LOG_TO_ROLLING);
$aa_sql->db_UpdateArray('user_extended',$xFields," WHERE `user_extended_id`=".intval($row['user_id']));
}
else
{ // Never been an extended user fields record for this user
$xFields['user_extended_id'] = $row['user_id'];
if (AA_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","Write new extended record".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
$aa_sql->db_Insert('user_extended',$xFields);
}
}
}
else
{ // Just add a new user
if (AA_DEBUG) $admin_log->e_log_event(10,debug_backtrace(),"DEBUG","Alt auth login","Add new user: ".print_r($db_vals,TRUE)."[!br!]".print_r($xFields,TRUE),FALSE,LOG_TO_ROLLING);
if (!isset($db_vals['user_name'])) $db_vals['user_name'] = $username;
if (!isset($db_vals['user_loginname'])) $db_vals['user_loginname'] = $username;
if (!isset($db_vals['user_join'])) $db_vals['user_join'] = time();
$db_vals['user_class'] = varset($pref['initial_user_classes'],'');
if (!isset($db_vals['user_signature'])) $db_vals['user_signature'] = '';
if (!isset($db_vals['user_prefs'])) $db_vals['user_prefs'] = '';
if (!isset($db_vals['user_perms'])) $db_vals['user_perms'] = '';
$newID = $aa_sql->db_Insert('user',$db_vals);
if (($newID !== FALSE) && count($xfields))
{
$xFields['user_extended_id'] = $newID;
$aa_sql->db_Insert('user_extended',$xFields);
}
}
return LOGIN_CONTINUE;
}
else
{ // Just add a new user
if (!isset($db_vals['user_name'])) $db_vals['user_name'] = $username;
if (!isset($db_vals['user_loginname'])) $db_vals['user_loginname'] = $username;
if (!isset($db_vals['user_join'])) $db_vals['user_join'] = time();
$db_vals['user_class'] = varset($pref['initial_user_classes'],'');
if (!isset($db_vals['user_signature'])) $db_vals['user_signature'] = '';
if (!isset($db_vals['user_prefs'])) $db_vals['user_prefs'] = '';
if (!isset($db_vals['user_perms'])) $db_vals['user_perms'] = '';
$aa_sql->db_Insert('user',$db_vals);
}
return LOGIN_CONTINUE;
}
else
{ // Failure modes
switch($login_result)
{
case AUTH_NOUSER:
if(!varset($pref['auth_nouser'],0))
{ // Failure modes
switch($login_result)
{
$username=md5("xx_nouser_xx");
return LOGIN_ABORT;
case AUTH_NOUSER:
if(!varset($pref['auth_nouser'],0))
{
$username=md5("xx_nouser_xx");
return LOGIN_ABORT;
}
break;
case AUTH_NOCONNECT:
if(!varset($pref['auth_noconn']))
{
$username=md5("xx_noconn_xx");
return LOGIN_ABORT;
}
break;
case AUTH_BADPASSWORD:
$userpass=md5("xx_badpassword_xx");
return LOGIN_ABORT; // Not going to magically be able to log in!
break;
}
break;
case AUTH_NOCONNECT:
if(!varset($pref['auth_noconn']))
{
$username=md5("xx_noconn_xx");
return LOGIN_ABORT;
}
break;
case AUTH_BADPASSWORD:
$userpass=md5("xx_badpassword_xx");
return LOGIN_ABORT; // Not going to magically be able to log in!
break;
}
}
return LOGIN_ABORT; // catch-all just in case
return LOGIN_ABORT; // catch-all just in case
}
}
?>

View File

@@ -12,14 +12,14 @@
+----------------------------------------------------------------------------+
*/
$eplug_admin = true;
require_once("../../class2.php");
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
include_lan("languages/".e_LANGUAGE."/lan_e107db_conf.php");
include_lan("languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
define("ALT_AUTH_ACTION", "e107db");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
require_once(e_PLUGIN."alt_auth/extended_password_handler.php");
require_once('../../class2.php');
require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'form_handler.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_e107db_conf.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php');
define('ALT_AUTH_ACTION', 'e107db');
require_once(e_PLUGIN.'alt_auth/alt_auth_adminmenu.php');
require_once(e_PLUGIN.'alt_auth/extended_password_handler.php');
if($_POST['update'])
{
@@ -51,7 +51,7 @@ function show_e107db_form()
$frm = new form;
$text = $frm -> form_open("post", e_SELF);
$text .= "<table style='width:96%'>";
$text .= "<table style='width:96%' class='fborder'>";
$text .= "<tr><td class='forumheader3'>".LAN_ALT_26."</td><td class='forumheader3'>";
$text .= E107DB_LAN_1;
@@ -89,31 +89,6 @@ require_once(e_ADMIN."footer.php");
// Obsolete function update_e107db_prefs()
/*
function update_e107db_prefs()
{
global $sql;
foreach($_POST as $k => $v)
{
$v = base64_encode(base64_encode($v));
if (substr($k,0,7) == 'e107db_')
// if(preg_match("/e107db_/", $k))
{
if($sql -> db_Select("alt_auth", "*", "auth_type='e107db' AND auth_parmname='{$k}' "))
{
$sql -> db_Update("alt_auth", "auth_parmval='{$v}' WHERE auth_type='e107db' AND auth_parmname='{$k}' ");
}
else
{
$sql -> db_Insert("alt_auth", "'e107db','{$k}','{$v}' ");
}
}
}
return E107DB_LAN_UPDATED;
}
*/
function e107db_conf_adminmenu()
{
alt_auth_adminmenu();

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -12,11 +12,11 @@
+----------------------------------------------------------------------------+
*/
$eplug_admin = true;
require_once("../../class2.php");
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
include_lan("languages/".e_LANGUAGE."/lan_importdb_conf.php");
include_lan("languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
require_once('../../class2.php');
require_once(e_ADMIN.'auth.php');
require_once(e_HANDLER.'form_handler.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_importdb_conf.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php');
define("ALT_AUTH_ACTION", "importdb");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
require_once(e_PLUGIN."alt_auth/extended_password_handler.php");
@@ -54,7 +54,7 @@ function show_importdb_form()
$frm = new form;
$text = $frm -> form_open("post", e_SELF);
$text .= "<table style='width:96%'>";
$text .= "<table style='width:96%' class='fborder'>";
$text .= "<tr><td colspan='2' class='forumheader3'>".IMPORTDB_LAN_11."</td></tr>";

View File

@@ -0,0 +1,28 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/languages/English/English_log.php,v $
| $Revision: 1.1 $
| $Date: 2008-12-09 20:40:54 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
define('LAN_AL_AUTH_01','Alt auth Settings changed');
define('LAN_AL_AUTH_02','Alt auth extended user classes changed');
define('LAN_AL_AUTH_03','Alt auth method settings changed');
define('LAN_AL_AUTH_04','');
define('LAN_AL_AUTH_05','');
define('LAN_AL_AUTH_06','');
?>

View File

@@ -1,13 +1,30 @@
<?php
define("LAN_ALT_1", "Current authorisation type");
define("LAN_ALT_2", "Update settings");
define("LAN_ALT_3", "Choose Alternate Authorisation Type");
define("LAN_ALT_4", "Configure parameters for");
define("LAN_ALT_5", "Configure authorisation parameters");
define("LAN_ALT_6", "Failed connection action");
define("LAN_ALT_7", "If connection to the alternate method fails, how should that be handled?");
define("LAN_ALT_8", "User not found action");
define("LAN_ALT_9", "If username is not found using alternate method, how should that be handled?");
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/languages/English/admin_alt_auth.php,v $
| $Revision: 1.1 $
| $Date: 2008-12-09 20:40:54 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
define('LAN_ALT_1', 'Current authorisation type');
define('LAN_ALT_2', 'Update settings');
define('LAN_ALT_3', 'Choose Alternate Authorisation Type');
define('LAN_ALT_4', 'Configure parameters for');
define('LAN_ALT_5', 'Configure authorisation parameters');
define('LAN_ALT_6', 'Failed connection action');
define('LAN_ALT_7', 'If connection to the alternate method fails, how should that be handled?');
define('LAN_ALT_8', 'User not found action');
define('LAN_ALT_9', 'If username is not found using alternate method, how should that be handled?');
define('LAN_ALT_10', 'User login name field');
define('LAN_ALT_11', 'User password field');
@@ -32,13 +49,13 @@ define('LAN_ALT_27', 'To transfer a field value into the local database, specify
define('LAN_ALT_29', 'Auth methods');
define('LAN_ALT_30', 'Configure ');
define('LAN_ALT_31', 'Main configuration');
define("LAN_ALT_32", "Server:");
define("LAN_ALT_33", "Username:");
define("LAN_ALT_34", "Password:");
define("LAN_ALT_35", "Database:");
define("LAN_ALT_36", "Table:");
define("LAN_ALT_37", "Username Field:");
define("LAN_ALT_38", "Password Field:");
define('LAN_ALT_32', 'Server:');
define('LAN_ALT_33', 'Username:');
define('LAN_ALT_34', 'Password:');
define('LAN_ALT_35', 'Database:');
define('LAN_ALT_36', 'Table:');
define('LAN_ALT_37', 'Username Field:');
define('LAN_ALT_38', 'Password Field:');
define('LAN_ALT_39', 'Table Prefix:');
define('LAN_ALT_40', 'Test database access');
@@ -61,15 +78,29 @@ define('LAN_ALT_56', 'bad password');
define('LAN_ALT_57', 'method not available');
define('LAN_ALT_58', 'Authentification successful');
define('LAN_ALT_59', 'Retrieved parameters:');
define('LAN_ALT_60', '');
define('LAN_ALT_60', 'Extended User Fields');
define('LAN_ALT_61', 'Allow');
define('LAN_ALT_62', 'Field Name');
define('LAN_ALT_63', 'Description');
define('LAN_ALT_64', 'Type');
define('LAN_ALT_65', 'Alternate Authentication');
define('LAN_ALT_66', 'This plugin allows for alternate authentication methods.');
define('LAN_ALT_67', 'Configure Alt auth');
define('LAN_ALT_68', 'Alt auth service is now set up. You will now need to configure your preferred method.');
define('LAN_ALT_69', '');
define('LAN_ALT_70', '');
define('LAN_ALT_FALLBACK', 'Use e107 user table');
define('LAN_ALT_FAIL', 'Failed login');
define('LAN_ALT_UPDATESET', 'Update settings');
define('LAN_ALT_UPDATED','Settings updated');
define('LAN_ALT_AUTH_HELP', 'These are the settings common to all authentication methods, and determine the actions to be taken');
define('LAN_ALT_AUTH_HELP', 'These are the settings common to all authentication methods, and determine the actions to be taken<br /><br />
The Extended User Field selection determines which <i>may</i> be added/updated when a user logs in - further configuration is required
for the specific authentication method.');
define('LAN_ALT_VALIDATE_HELP', 'You can check the settings by using the \'Test Database Access\' section to try and validate a user - this uses exactly
the same process as when a user tries to log in, and confirms whether your settings are correct');
the same process as when a user tries to log in, and confirms whether your settings are correct
');
?>

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/ldap_auth.php,v $
| $Revision: 1.4 $
| $Date: 2008-12-01 21:47:17 $
| $Revision: 1.5 $
| $Date: 2008-12-09 20:40:54 $
| $Author: e107steved $
To do:
@@ -210,7 +210,6 @@ class auth_login
$entries = ldap_get_entries($this->connection, $this->result);
if (count($entries) == 2) // All OK
{
echo "Count: {$entries[0]['count']}<br />";
for ($j = 0; $j < $entries[0]['count']; $j++)
{
$k = $entries[0][$j]; // LDAP attribute name

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/ldap_conf.php,v $
| $Revision: 1.4 $
| $Date: 2008-12-01 21:47:17 $
| $Revision: 1.5 $
| $Date: 2008-12-09 20:40:54 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@@ -20,10 +20,10 @@ $eplug_admin = true;
require_once("../../class2.php");
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
include_lan("languages/".e_LANGUAGE."/lan_ldap_conf.php");
include_lan("languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
define("ALT_AUTH_ACTION", "ldap");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE."/admin_ldap_conf.php");
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php');
define('ALT_AUTH_ACTION', 'ldap');
require_once(e_PLUGIN.'alt_auth/alt_auth_adminmenu.php');
$server_types[1]="LDAP";
@@ -63,7 +63,7 @@ $current_filter = "(&(cn=[USERNAME]){$ldap['ldap_edirfilter']})";
$frm = new form;
$text = $frm -> form_open("post",e_SELF);
$text .= "<table style='width:96%'>";
$text .= "<table style='width:96%' class='fborder'>";
$text .= "<tr><td class='forumheader3'>".LDAPLAN_12."</td><td class='forumheader3'>";
$text .= $frm -> form_select_open("ldap_servertype");
foreach($server_types as $v)
@@ -110,6 +110,7 @@ $text .= "<br /><span class='smalltext'>".LDAPLAN_9."<br />".htmlentities($curre
$text .= "<tr><td class='forumheader2' colspan='2'>".LAN_ALT_27."</td></tr>";
add_extended_fields();
$text .= alt_auth_get_field_list('ldap',$frm, $ldap, FALSE);
$text .= "<tr><td class='forumheader' colspan='2' style='text-align:center;'>";

View File

@@ -15,11 +15,11 @@ $eplug_admin = true;
require_once("../../class2.php");
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
include_lan("languages/".e_LANGUAGE."/lan_otherdb_conf.php");
include_lan("languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
define("ALT_AUTH_ACTION", "otherdb");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
require_once(e_PLUGIN."alt_auth/extended_password_handler.php");
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_otherdb_conf.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php');
define('ALT_AUTH_ACTION', 'otherdb');
require_once(e_PLUGIN.'alt_auth/alt_auth_adminmenu.php');
require_once(e_PLUGIN.'alt_auth/extended_password_handler.php');
if($_POST['update'])
{
@@ -52,7 +52,7 @@ function show_otherdb_form()
$frm = new form;
$text = $frm -> form_open("post", e_SELF);
$text .= "<table style='width:96%'>";
$text .= "<table style='width:96%' class='fborder'>";
$text .= "<tr><td class='forumheader3'>".LAN_ALT_26."</td><td class='forumheader3'>";
$text .= OTHERDB_LAN_15;
@@ -87,29 +87,8 @@ function show_otherdb_form()
require_once(e_ADMIN."footer.php");
/*
function update_otherdb_prefs()
{
global $sql;
foreach($_POST as $k => $v)
{
$v = base64_encode(base64_encode($v));
if(preg_match("/otherdb_/", $k))
{
if($sql -> db_Select("alt_auth", "*", "auth_type='otherdb' AND auth_parmname='{$k}' "))
{
$sql -> db_Update("alt_auth", "auth_parmval='{$v}' WHERE auth_type='otherdb' AND auth_parmname='{$k}' ");
}
else
{
$sql -> db_Insert("alt_auth", "'otherdb','{$k}','{$v}' ");
}
}
}
return "Settings Updated";
}
*/
function otherdb_conf_adminmenu()
{
alt_auth_adminmenu();

View File

@@ -1,74 +0,0 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <20>Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/plugin.php,v $
| $Revision: 1.2 $
| $Date: 2008-07-25 19:33:03 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
// Plugin info -------------------------------------------------------------------------------------------------------
$eplug_name = "Alternate Authentication";
$eplug_version = "0.4";
$eplug_author = "McFly";
$eplug_logo = "/images/icon_ldap.png";
$eplug_url = "";
$eplug_email = "mcfly@e107.org";
$eplug_description = "This plugin allows for alternate authentication methods.";
$eplug_compatible = "e107v7+";
$eplug_readme = ""; // leave blank if no readme file
// Name of the plugin's folder -------------------------------------------------------------------------------------
$eplug_folder = "alt_auth";
// Mane of menu item for plugin ----------------------------------------------------------------------------------
$eplug_menu_name = "alt_auth";
// Name of the admin configuration file --------------------------------------------------------------------------
$eplug_conffile = "alt_auth_conf.php";
// Icon image and caption text ------------------------------------------------------------------------------------
$eplug_icon = $eplug_folder."/images/icon_ldap.png";
$eplug_caption = "Configure Alt auth";
// List of preferences -----------------------------------------------------------------------------------------------
$eplug_prefs = "";
// List of table names -----------------------------------------------------------------------------------------------
$eplug_table_names = array(
"alt_auth"
);
// List of sql requests to create tables -----------------------------------------------------------------------------
$eplug_tables = array(
"CREATE TABLE ".MPREFIX."alt_auth (
auth_type varchar(20) NOT NULL default '',
auth_parmname varchar(30) NOT NULL default '',
auth_parmval varchar(120) NOT NULL default ''
) TYPE=MyISAM;");
// Create a link in main menu (yes=TRUE, no=FALSE) -------------------------------------------------------------
$eplug_link = FALSE;
$eplug_link_name = "";
$eplug_link_url = "";
// Text to display after plugin successfully installed ------------------------------------------------------------------
$eplug_done = "Alt auth service is now set up. You will now need to configure your preferred method.";
?>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Id: plugin.xml,v 1.1 2008-12-09 20:40:54 e107steved Exp $ -->
<e107Plugin name="LAN_ALT_65" version="0.4" compatibility="0.8" installRequired="true" >
<author name="McFly/steved" url="e107.org" email="mcfly@e107.org" />
<description>LAN_ALT_66</description>
<folder>alt_auth</folder>
<copyright>Copyright e107 Inc e107.org, Licensed under GPL (http://www.gnu.org/licenses/gpl.txt)</copyright>
<logLanguageFile filename="languages/--LAN--/--LAN--_log.php" />
<administration>
<configFile>alt_auth_conf.php</configFile>
<icon>images/alt_auth_32.png</icon>
<iconSmall>images/alt_auth_16.png</iconSmall>
<caption>LAN_ALT_67</caption>
<installDone>LAN_ALT_68</installDone>
</administration>
<mainPrefs>
<pref name="auth_noconn" value="0" />
<pref name="auth_nouser" value="0" />
<pref name="auth_extended" value="" />
</mainPrefs>
</e107Plugin>

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_plugins/alt_auth/radius_conf.php,v $
| $Revision: 1.1 $
| $Date: 2008-09-02 19:39:12 $
| $Revision: 1.2 $
| $Date: 2008-12-09 20:40:54 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@@ -20,8 +20,8 @@ $eplug_admin = true;
require_once("../../class2.php");
require_once(e_ADMIN."auth.php");
require_once(e_HANDLER."form_handler.php");
include_lan("languages/".e_LANGUAGE."/lan_radius_conf.php");
include_lan("languages/".e_LANGUAGE."/lan_alt_auth_conf.php");
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_radius_conf.php');
include_lan(e_PLUGIN.'alt_auth/languages/'.e_LANGUAGE.'/admin_alt_auth.php');
define("ALT_AUTH_ACTION", "radius");
require_once(e_PLUGIN."alt_auth/alt_auth_adminmenu.php");
@@ -53,7 +53,7 @@ while($row = $sql->db_Fetch())
$frm = new form;
$text = $frm -> form_open("post",e_SELF);
$text .= "<table style='width:96%'>";
$text .= "<table style='width:96%' class='fborder'>";
$text .= "<tr><td class='forumheader3'>".LAN_RADIUS_01."</td><td class='forumheader3'>";
$text .= $frm -> form_text("radius_server", 35, $radius['radius_server'], 120);
$text .= "</td></tr>";