From 52e822160847f4bf658e766c5a502da714465dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Oudot?= Date: Fri, 1 Oct 2010 09:06:32 +0000 Subject: [PATCH] Correct code of updateSession --- .../lib/Lemonldap/NG/Portal/Simple.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm index 6238c1559..fa45a8418 100644 --- a/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm +++ b/modules/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Simple.pm @@ -781,8 +781,17 @@ sub updateSession { my ( $self, $infos, $id ) = splice @_; my %cookies = fetch CGI::Cookie; + # Return if no infos to update + return undef unless ( ref $infos eq 'HASH' and %$infos ); + # Update sessionInfo datas - $self->{sessionInfo}->{$_} = $infos->{$_} unless ($id); + if ($id) { + foreach ( keys %$infos ) { + $self->lmLog( "Update sessionInfo $_ with " . $infos->{$_}, + 'debug' ); + $self->{sessionInfo}->{$_} = $infos->{$_}; + } + } # Recover session ID unless given $id ||= $self->{id}; @@ -794,6 +803,7 @@ sub updateSession { # Store/update session values foreach ( keys %$infos ) { + $self->lmLog( "Update session $_ with " . $infos->{$_}, 'debug' ); $h->{$_} = $infos->{$_}; }