LEMONLDAP::NG : web form in a distinct file

This commit is contained in:
Xavier Guimard 2008-11-24 14:06:54 +00:00
parent a72eebdd81
commit d99ef1ba3f
3 changed files with 34 additions and 25 deletions

View File

@ -78,6 +78,7 @@ example/slavePortal.pl
lib/Lemonldap/NG/Portal.pm
lib/Lemonldap/NG/Portal/_i18n.pm
lib/Lemonldap/NG/Portal/_LDAP.pm
lib/Lemonldap/NG/Portal/_WebForm.pm
lib/Lemonldap/NG/Portal/AuthApache.pm
lib/Lemonldap/NG/Portal/AuthCAS.pm
lib/Lemonldap/NG/Portal/AuthLA.pm

View File

@ -2,8 +2,10 @@ package Lemonldap::NG::Portal::AuthLDAP;
use Lemonldap::NG::Portal::Simple;
use Lemonldap::NG::Portal::_LDAP;
use Lemonldap::NG::Portal::_WebForm;
our $VERSION = '0.1';
our @ISA = qw(Lemonldap::NG::Portal::_WebForm);
sub ldap {
my $self = shift;
@ -17,31 +19,6 @@ sub ldap {
return $self->{ldap};
}
sub authInit {
PE_OK;
}
sub extractFormInfo {
my $self = shift;
return PE_FIRSTACCESS
unless ( $self->param('user') );
return PE_FORMEMPTY
unless ( length( $self->{'user'} = $self->param('user') ) > 0
&& length( $self->{'password'} = $self->param('password') ) > 0 );
PE_OK;
}
sub setAuthSessionInfo {
my $self = shift;
# Store submitted password if set in configuration
# WARNING: it can be a security hole
if ( $self->{storePassword} ) {
$self->{sessionInfo}->{'_password'} = $self->{'password'};
}
PE_OK;
}
sub authenticate {
my $self = shift;
unless ( $self->ldap ) {

View File

@ -0,0 +1,31 @@
package Lemonldap::NG::Portal::_WebForm;
use Lemonldap::NG::Portal::Simple qw(:all);
use strict;
sub authInit {
PE_OK;
}
sub extractFormInfo {
my $self = shift;
return PE_FIRSTACCESS
unless ( $self->param('user') );
return PE_FORMEMPTY
unless ( length( $self->{'user'} = $self->param('user') ) > 0
&& length( $self->{'password'} = $self->param('password') ) > 0 );
PE_OK;
}
sub setAuthSessionInfo {
my $self = shift;
# Store submitted password if set in configuration
# WARNING: it can be a security hole
if ( $self->{storePassword} ) {
$self->{sessionInfo}->{'_password'} = $self->{'password'};
}
PE_OK;
}
1;