Commit 217e4c43 authored by Christophe Maudoux's avatar Christophe Maudoux

Fix display (#1550)

parent 3d5cae59
......@@ -2,6 +2,7 @@ package Lemonldap::NG::Portal::Auth::Custom;
use strict;
# Fake 'new' method here. Return Lemonldap::NG::Portal::Auth::Custom::{CustomAuth}->new
sub new {
my ( $class, $self ) = @_;
unless ( $self->{conf}->{customAuth} ) {
......@@ -15,11 +16,20 @@ sub new {
}
sub getDisplayType {
my ( $class, $self ) = @_;
( -e $self->{conf}->{templateDir}
. "/../htdocs/static/common/modules/"
. $self->{conf}->{customAuth}
. ".png" ) ? return "logo" : return "standardform";
# Warning : $self passed here is the Portal itself
my ($self) = @_;
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");
return "logo";
};
return "standardform";
}
1;
......@@ -234,19 +234,24 @@ sub _buildAuthLoop {
# Get displayType for this module
no strict 'refs';
my $displayType = "Lemonldap::NG::Portal::Auth::${auth}"
->can('getDisplayType')->( undef, $req );
->can('getDisplayType')->( $self, $req );
$self->logger->debug(
"Display type $displayType for module $auth");
$optionsLoop->{$displayType} = 1;
my $logo = $_;
if ( $auth eq 'Custom' ) {
$logo
= ( $self->{conf}->{customAuth} =~ /::(\w+)$/ )[0];
}
# If displayType is logo, check if key.png is available
if ( -e $self->conf->{templateDir}
. "/../htdocs/static/common/modules/"
. $_
. $logo
. ".png" )
{
$optionsLoop->{logoFile} = $_ . ".png";
$optionsLoop->{logoFile} = $logo . ".png";
}
else {
$optionsLoop->{logoFile} = $auth . ".png";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment