From 2a021e37eadcc92cb0c8be1d7bd1cd38024d9fd8 Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Thu, 13 Jun 2019 17:51:36 +0200 Subject: [PATCH] Don't require getDisplayType in Choice (#1800) --- .../lib/Lemonldap/NG/Portal/Lib/Choice.pm | 6 ++++-- .../lib/Lemonldap/NG/Portal/Main/Display.pm | 3 ++- lemonldap-ng-portal/t/28-AuthChoice-and-password.t | 10 ++++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Choice.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Choice.pm index 34fea5d31..81f7e7003 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Choice.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/Choice.pm @@ -231,8 +231,10 @@ sub _buildAuthLoop { # Get displayType for this module no strict 'refs'; - my $displayType = "Lemonldap::NG::Portal::Auth::${auth}" - ->can('getDisplayType')->( $self, $req ); + my $displayType = eval { + "Lemonldap::NG::Portal::Auth::${auth}" + ->can('getDisplayType')->( $self, $req ); + } || 'logo'; $self->logger->debug( "Display type $displayType for module $auth"); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm index a73983b44..d8bec36d4 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Display.pm @@ -388,7 +388,8 @@ sub display { else { my $displayType = - eval { $self->_authentication->getDisplayType($req) }; + eval { $self->_authentication->getDisplayType($req) } + || 'logo'; $self->logger->debug("Display type $displayType "); diff --git a/lemonldap-ng-portal/t/28-AuthChoice-and-password.t b/lemonldap-ng-portal/t/28-AuthChoice-and-password.t index e98d3ad43..7c655a53a 100644 --- a/lemonldap-ng-portal/t/28-AuthChoice-and-password.t +++ b/lemonldap-ng-portal/t/28-AuthChoice-and-password.t @@ -31,8 +31,9 @@ SKIP: { authChoiceParam => 'test', authChoiceModules => { - ldap => 'LDAP;LDAP;LDAP', - sql => 'DBI;DBI;DBI', + ldap => 'LDAP;LDAP;LDAP', + sql => 'DBI;DBI;DBI', + slave => 'Slave;LDAP;LDAP', }, dbiAuthChain => 'dbi:SQLite:dbname=t/userdb.db', @@ -47,6 +48,11 @@ SKIP: { ldapBase => 'ou=users,dc=example,dc=com', managerDn => 'cn=admin,dc=example,dc=com', managerPassword => 'admin', + + slaveUserHeader => 'My-Test', + slaveExportedVars => { + name => 'Name', + } } } );