2008-12-26 20:18:23 +01:00
|
|
|
##@file
|
|
|
|
# Web form authentication backend file
|
|
|
|
|
|
|
|
##@class
|
|
|
|
# Web form authentication backend class
|
2008-11-24 15:06:54 +01:00
|
|
|
package Lemonldap::NG::Portal::_WebForm;
|
|
|
|
|
|
|
|
use Lemonldap::NG::Portal::Simple qw(:all);
|
|
|
|
use strict;
|
|
|
|
|
2009-02-17 15:56:38 +01:00
|
|
|
## @apmethod int authInit()
|
2008-12-26 20:18:23 +01:00
|
|
|
# Does nothing.
|
2008-12-28 09:36:52 +01:00
|
|
|
# @return Lemonldap::NG::Portal constant
|
2008-11-24 15:06:54 +01:00
|
|
|
sub authInit {
|
|
|
|
PE_OK;
|
|
|
|
}
|
|
|
|
|
2009-02-17 15:56:38 +01:00
|
|
|
## @apmethod int extractFormInfo()
|
2008-12-26 20:18:23 +01:00
|
|
|
# Read username and password from POST datas
|
2008-12-28 09:36:52 +01:00
|
|
|
# @return Lemonldap::NG::Portal constant
|
2008-11-24 15:06:54 +01:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2009-02-17 15:56:38 +01:00
|
|
|
## @apmethod int setAuthSessionInfo()
|
2008-12-26 20:18:23 +01:00
|
|
|
# Set password in session datas if wanted.
|
2008-12-28 09:36:52 +01:00
|
|
|
# @return Lemonldap::NG::Portal constant
|
2008-11-24 15:06:54 +01:00
|
|
|
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;
|