Namespaced forvars to prevent ambiguity.
This commit is contained in:
parent
bbda83a487
commit
908ead7a4e
3 changed files with 50 additions and 50 deletions
|
|
@ -66,13 +66,13 @@ sub authenticate {
|
|||
#-------------------------------------------------------------------
|
||||
sub adminForm {
|
||||
my $userData = WebGUI::Authentication::getParams($_[0],'LDAP');
|
||||
my $ldapURL = $session{form}{ldapURL} || $userData->{ldapURL} || $session{setting}{ldapURL};
|
||||
my $connectDN = $session{form}{connectDN} || $userData->{connectDN};
|
||||
my $ldapURL = $session{form}{authLDAP.ldapURL} || $userData->{ldapURL} || $session{setting}{ldapURL};
|
||||
my $connectDN = $session{form}{authLDAP.connectDN} || $userData->{connectDN};
|
||||
my $f;
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->readOnly('<b>'.optionsLabel().'</b>');
|
||||
$f->url("ldapURL",WebGUI::International::get(3,'Auth/LDAP'),$ldapURL);
|
||||
$f->text("connectDN",WebGUI::International::get(4,'Auth/LDAP'),$connectDN);
|
||||
$f->url("authLDAP.ldapURL",WebGUI::International::get(3,'Auth/LDAP'),$ldapURL);
|
||||
$f->text("authLDAP.connectDN",WebGUI::International::get(4,'Auth/LDAP'),$connectDN);
|
||||
return $f->printRowsOnly;
|
||||
}
|
||||
|
||||
|
|
@ -80,8 +80,8 @@ sub adminForm {
|
|||
sub adminFormSave {
|
||||
WebGUI::Authentication::saveParams($_[0],'LDAP',
|
||||
{
|
||||
connectDN => $session{form}{connectDN},
|
||||
ldapURL => $session{form}{ldapURL}
|
||||
connectDN => $session{form}{authLDAP.connectDN},
|
||||
ldapURL => $session{form}{authLDAP.ldapURL}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -99,8 +99,8 @@ sub optionsLabel {
|
|||
sub registrationForm {
|
||||
my $f;
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->text("ldapId",$session{setting}{ldapIdName});
|
||||
$f->password("ldapPassword",$session{setting}{ldapPasswordName});
|
||||
$f->text("authLDAP.ldapId",$session{setting}{ldapIdName});
|
||||
$f->password("authLDAP.ldapPassword",$session{setting}{ldapPasswordName});
|
||||
return $f->printRowsOnly;
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +117,7 @@ sub registrationFormSave {
|
|||
%args = (port => $port);
|
||||
$ldap = Net::LDAP->new($uri->host, %args);
|
||||
$ldap->bind;
|
||||
$search = $ldap->search (base => $uri->dn, filter => $session{setting}{ldapId}."=".$session{form}{ldapId});
|
||||
$search = $ldap->search (base => $uri->dn, filter => $session{setting}{ldapId}."=".$session{form}{authLDAP.ldapId});
|
||||
if (defined $search->entry(0)) {
|
||||
$connectDN = "cn=".$search->entry(0)->get_value("cn");
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ sub registrationFormSave {
|
|||
connectDN => $connectDN,
|
||||
ldapURL => $session{setting}{ldapURL}
|
||||
});
|
||||
return $session{form}{ldapId};
|
||||
return $session{form}{authLDAP.ldapId};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -141,15 +141,15 @@ sub registrationFormValidate {
|
|||
}
|
||||
if ($ldap = Net::LDAP->new($uri->host, {port=>$port})) {
|
||||
if ($ldap->bind) {
|
||||
$search = $ldap->search (base=>$uri->dn,filter=>$session{setting}{ldapId}."=".$session{form}{ldapId});
|
||||
$search = $ldap->search (base=>$uri->dn,filter=>$session{setting}{ldapId}."=".$session{form}{authLDAP.ldapId});
|
||||
if (defined $search->entry(0)) {
|
||||
$connectDN = "cn=".$search->entry(0)->get_value("cn");
|
||||
$ldap->unbind;
|
||||
$ldap = Net::LDAP->new($uri->host, {port=>$port}) or $error .= WebGUI::International::get(2,'Auth/LDAP');
|
||||
$auth = $ldap->bind(dn=>$connectDN, password=>$session{form}{ldapPassword});
|
||||
$auth = $ldap->bind(dn=>$connectDN, password=>$session{form}{authLDAP.ldapPassword});
|
||||
if ($auth->code == 48 || $auth->code == 49) {
|
||||
$error .= '<li>'.WebGUI::International::get(68);
|
||||
WebGUI::ErrorHandler::warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{ldapId});
|
||||
WebGUI::ErrorHandler::warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{authLDAP.ldapId});
|
||||
} elsif ($auth->code > 0) {
|
||||
$error .= '<li>LDAP error "'.$ldapStatusCode{$auth->code}.'" occured. '
|
||||
.WebGUI::International::get(69);
|
||||
|
|
@ -158,7 +158,7 @@ sub registrationFormValidate {
|
|||
$ldap->unbind;
|
||||
} else {
|
||||
$error .= '<li>'.WebGUI::International::get(68);
|
||||
WebGUI::ErrorHandler::warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{ldapId});
|
||||
WebGUI::ErrorHandler::warn("Invalid LDAP information for registration of LDAP ID: ".$session{form}{authLDAP.ldapId});
|
||||
}
|
||||
} else {
|
||||
$error = WebGUI::International::get(2,'Auth/LDAP');
|
||||
|
|
@ -174,10 +174,10 @@ sub settingsForm {
|
|||
my $f;
|
||||
$f = WebGUI::HTMLForm->new;
|
||||
$f->readOnly('<b>'.optionsLabel().'</b>');
|
||||
$f->url("ldapURL",WebGUI::International::get(5,'Auth/LDAP'),$session{setting}{ldapURL});
|
||||
$f->text("ldapId",WebGUI::International::get(6,'Auth/LDAP'),$session{setting}{ldapId});
|
||||
$f->text("ldapIdName",WebGUI::International::get(7,'Auth/LDAP'),$session{setting}{ldapIdName});
|
||||
$f->text("ldapPasswordName",WebGUI::International::get(8,'Auth/LDAP'),$session{setting}{ldapPasswordName});
|
||||
$f->url("authLDAP.ldapURL",WebGUI::International::get(5,'Auth/LDAP'),$session{setting}{ldapURL});
|
||||
$f->text("authLDAP.ldapId",WebGUI::International::get(6,'Auth/LDAP'),$session{setting}{ldapId});
|
||||
$f->text("authLDAP.ldapIdName",WebGUI::International::get(7,'Auth/LDAP'),$session{setting}{ldapIdName});
|
||||
$f->text("authLDAP.ldapPasswordName",WebGUI::International::get(8,'Auth/LDAP'),$session{setting}{ldapPasswordName});
|
||||
return $f->printRowsOnly;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue