From c8fe1156500766fdde6f4e6d079159541164e05a Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Fri, 2 Dec 2016 05:47:38 +0000 Subject: [PATCH] Little things (#595) --- lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Remote.pm | 2 ++ .../lib/Lemonldap/NG/Portal/Auth/_WebForm.pm | 6 +++--- lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm | 2 -- lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm | 4 +++- lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm | 5 +++-- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Remote.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Remote.pm index 73fdf446e..207eba38b 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Remote.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Remote.pm @@ -31,6 +31,8 @@ sub setAuthSessionInfo { # Store password (deleted in checkRemoteId() if local policy does not accept # stored passwords) $req->{sessionInfo}->{'_password'} = $req->datas->{'password'}; + $req->{sessionInfo}->{authenticationLevel} = + $req->datas->{rSessionInfo}->{authenticationLevel}; PE_OK; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/_WebForm.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/_WebForm.pm index b4ff59965..8b67bd137 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/_WebForm.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/_WebForm.pm @@ -121,17 +121,17 @@ sub setAuthSessionInfo { my ( $self, $req ) = @_; # authenticationLevel - $self->{sessionInfo}->{authenticationLevel} = $self->authnLevel; + $req->{sessionInfo}->{authenticationLevel} = $self->authnLevel; # Store submitted password if set in configuration # WARNING: it can be a security hole if ( $self->conf->{storePassword} ) { - $self->{sessionInfo}->{'_password'} = $req->datas->{'newpassword'} + $req->{sessionInfo}->{'_password'} = $req->datas->{'newpassword'} || $req->datas->{'password'}; } # Store user timezone - $self->{sessionInfo}->{'_timezone'} = $self->{'timezone'}; + $req->{sessionInfo}->{'_timezone'} = $self->{'timezone'}; PE_OK; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm index 988fb34fb..8816a6d73 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Init.pm @@ -178,8 +178,6 @@ sub reloadConf { return 0 unless ( $self->{"_$type"} = $self->loadPlugin($module) ); } - $self->_authentication->authnLevel( - $self->conf->{ $self->conf->{authentication} . "AuthnLevel" // 0 } ); # Initialize trusted domain regexp if ( $self->conf->{trustedDomains} diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm index c37c83918..1d89d9ded 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Process.pm @@ -245,7 +245,9 @@ sub authenticate { sub setAuthSessionInfo { my ( $self, $req ) = @_; my $ret = $self->_authentication->setAuthSessionInfo($req); - if ( $ret == PE_OK and not( $req->sessionInfo->{authenticationLevel} ) ) { + if ( $ret == PE_OK + and not( defined $req->sessionInfo->{authenticationLevel} ) ) + { $self->lmLog( 'Authentication level is not set by auth module', 'error' ); } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm index 8e206e854..4089eda66 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Main/Run.pm @@ -159,6 +159,7 @@ sub do { and ( $err != PE_REDIRECT or ( $err == PE_REDIRECT + and $req->datas->{redirectFormMethod} and $req->datas->{redirectFormMethod} eq 'post' ) ) ) @@ -517,8 +518,8 @@ sub setHiddenFormValue { # Store value if ($val) { - $key = $prefix . $key; - $val = encode_base64($val,'') if $base64; + $key = $prefix . $key; + $val = encode_base64( $val, '' ) if $base64; $req->{portalHiddenFormValues}->{$key} = $val; $self->lmLog( "Store $val in hidden key $key", 'debug' ); }