diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/DBI.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/DBI.pm index 705ae3af7d280853756656a25c6121b2737b6c23..d6ea5130695262444a53d7dd5c30486ab4f85c53 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/DBI.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Conf/DBI.pm @@ -43,7 +43,8 @@ sub lastCfg { sub dbh { my $self = shift; $self->{dbiTable} ||= "lmconfig"; - return $self->{dbh} ||= DBI->connect_cached( + return $self->{dbh} if ( $self->{dbh} and $self->{dbh}->ping ); + return DBI->connect_cached( $self->{dbiChain}, $self->{dbiUser}, $self->{dbiPassword}, { RaiseError => 1 } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm index ca34355efa41854d4751e87ad9b370f07791f6c1..af697cbf0fe8833b7184fc01c64512b904d3f528 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm @@ -130,8 +130,8 @@ sub header { # CGI.pm overload to add Lemonldap::NG cookie sub redirect { my $self = shift; - if ( $_[0]->{cookie} ) { - $self->SUPER::redirect( @_, -cookie => $_[0]->{cookie} ); + if ( $self->{cookie} ) { + $self->SUPER::redirect( @_, -cookie => $self->{cookie} ); } else { $self->SUPER::redirect(@_);