2017-03-07 18:28:09 +01:00
|
|
|
package Lemonldap::NG::Portal::Auth::Custom;
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
2018-11-23 22:08:06 +01:00
|
|
|
# Fake 'new' method here. Return Lemonldap::NG::Portal::Auth::Custom::{CustomAuth}->new
|
2017-03-07 18:28:09 +01:00
|
|
|
sub new {
|
|
|
|
my ( $class, $self ) = @_;
|
|
|
|
unless ( $self->{conf}->{customAuth} ) {
|
2018-08-29 18:52:22 +02:00
|
|
|
die 'Custom Auth module not defined';
|
2017-03-07 18:28:09 +01:00
|
|
|
}
|
2018-08-29 18:52:22 +02:00
|
|
|
|
2018-11-29 21:12:43 +01:00
|
|
|
my $res;
|
|
|
|
eval { $res = $self->{p}->loadModule( $self->{conf}->{customAuth} ) };
|
|
|
|
die 'Unable to load Auth module ' . $self->{conf}->{customAuth} if ($@);
|
|
|
|
return $res;
|
2018-11-22 19:59:43 +01:00
|
|
|
}
|
|
|
|
|
2019-03-19 05:56:36 +01:00
|
|
|
sub getForm {
|
2018-11-23 22:08:06 +01:00
|
|
|
|
|
|
|
# Warning : $self passed here is the Portal itself
|
2019-03-19 05:56:36 +01:00
|
|
|
my ( $self, $req ) = @_;
|
2018-11-23 22:08:06 +01:00
|
|
|
my $logo = ( $self->{conf}->{customAuth} =~ /::(\w+)$/ )[0];
|
|
|
|
|
|
|
|
if ( -e $self->{conf}->{templateDir}
|
|
|
|
. "/../htdocs/static/common/modules/"
|
|
|
|
. $logo
|
|
|
|
. ".png" )
|
|
|
|
{
|
|
|
|
$self->logger->debug("CustomAuth $logo.png found");
|
2019-03-19 05:56:36 +01:00
|
|
|
$req->tplParams->{CUSTOM_LOGO} = "common/modules/$logo.png";
|
2018-11-23 22:08:06 +01:00
|
|
|
return "logo";
|
2018-11-26 14:40:21 +01:00
|
|
|
}
|
2018-11-23 22:08:06 +01:00
|
|
|
return "standardform";
|
2017-03-07 18:28:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|