From 2153546c4c1e7603eda904b00d1a37f23b4bf884 Mon Sep 17 00:00:00 2001 From: Christophe Maudoux Date: Wed, 29 Aug 2018 18:52:22 +0200 Subject: [PATCH] Display error msg --- .../lib/Lemonldap/NG/Portal/Auth/Custom.pm | 8 ++++++-- .../lib/Lemonldap/NG/Portal/Password/Custom.pm | 8 ++++++-- .../lib/Lemonldap/NG/Portal/UserDB/Custom.pm | 8 ++++++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Custom.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Custom.pm index d9b54dc35..3eb9016e9 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Custom.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Custom.pm @@ -5,9 +5,13 @@ use strict; sub new { my ( $class, $self ) = @_; unless ( $self->{conf}->{customAuth} ) { - die 'Custom auth module not defined'; + die 'Custom Auth module not defined'; } - return $self->{p}->loadModule( $self->{conf}->{customAuth} ); + + eval $self->{p}->loadModule( $self->{conf}->{customAuth} ); + ($@) + ? return $self->{p}->loadModule( $self->{conf}->{customAuth} ) + : die 'Unable to load Auth module ' . $self->{conf}->{customAuth}; } 1; diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/Custom.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/Custom.pm index 5bba46169..d74be6383 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/Custom.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Password/Custom.pm @@ -5,9 +5,13 @@ use strict; sub new { my ( $class, $self ) = @_; unless ( $self->{conf}->{customPassword} ) { - die 'Custom password module not defined'; + die 'Custom Password module not defined'; } - return $self->{p}->loadModule( $self->{conf}->{customPassword} ); + + eval $self->{p}->loadModule( $self->{conf}->{customPassword} ); + ($@) + ? return $self->{p}->loadModule( $self->{conf}->{customPassword} ) + : die 'Unable to load Password module ' . $self->{conf}->{customPassword}; } 1; diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Custom.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Custom.pm index 5ebdbc7c7..1aa4ba1fe 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Custom.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDB/Custom.pm @@ -5,9 +5,13 @@ use strict; sub new { my ( $class, $self ) = @_; unless ( $self->{conf}->{customUserDB} ) { - die 'Custom user DB module not defined'; + die 'Custom User DB module not defined'; } - return $self->{p}->loadModule( $self->{conf}->{customUserDB} ); + + eval $self->{p}->loadModule( $self->{conf}->{customUserDB} ); + ($@) + ? return $self->{p}->loadModule( $self->{conf}->{customUserDB} ) + : die 'Unable to load UserDB module ' . $self->{conf}->{customUserDB}; } 1; -- 2.22.0