From ffda037c526c320147a98b91dceeca4355da8dfa Mon Sep 17 00:00:00 2001 From: Xavier Guimard Date: Sun, 13 Oct 2013 12:15:01 +0000 Subject: [PATCH] Use user* methods instead of lmLog for user actions (can be put in syslog) --- .../lib/Lemonldap/NG/Portal/AuthGoogle.pm | 10 ++++------ .../lib/Lemonldap/NG/Portal/AuthOpenID.pm | 5 +++-- .../lib/Lemonldap/NG/Portal/AuthRadius.pm | 4 ++-- .../lib/Lemonldap/NG/Portal/UserDBDBI.pm | 4 ++-- lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_CAS.pm | 2 +- lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_DBI.pm | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthGoogle.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthGoogle.pm index 508a2d582..dd408ff4f 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthGoogle.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthGoogle.pm @@ -139,9 +139,8 @@ sub checkGoogleSession { # Case 1: value was asked but not returned, set an empty value # in persistent session (so that it's defined) if ( $self->{_AXNS} ) { - $self->lmLog( -"$v required attribute is missing in Google response, storing ''", - 'info' + $self->_sub( 'userInfo', +"$v required attribute is missing in Google response, storing ''" ); $h->{$v} = $gs->{$v} = ''; } @@ -149,9 +148,8 @@ sub checkGoogleSession { # Case 2: value is not stored, probably configuration has # changed and this value was never asked else { - $self->lmLog( -"$v required attribute is missing in persistent session, let's ask it", - 'info' + $self->_sub( 'userInfo', +"$v required attribute is missing in persistent session, let's ask it" ); return 0; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthOpenID.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthOpenID.pm index b9fe251fc..2555a5369 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthOpenID.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthOpenID.pm @@ -77,7 +77,7 @@ sub extractFormInfo { # If confirmation is needed if ( my $setup_url = $csr->user_setup_url ) { - $self->lmLog( 'OpenID confirmation needed', 'info' ); + $self->_sub( 'userInfo', 'OpenID confirmation needed' ); print $self->redirect($setup_url); $self->quit(); } @@ -113,7 +113,8 @@ sub extractFormInfo { if ( $tmp =~ $self->{_reopenIdIDPList} xor $self->{_openIdIDPListIsWhite} ) { - $self->lmLog( "$url is forbidden for openID exchange", 'warn' ); + $self->_sub( 'userNotice', + "$url is forbidden for openID exchange" ); $self->{_msg} = "OpenID error: $tmp is forbidden for OpenID echange"; return PE_BADPARTNER; diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthRadius.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthRadius.pm index 2416232c9..39fcd74f3 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthRadius.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/AuthRadius.pm @@ -55,8 +55,8 @@ sub authenticate { my $res = $self->{radius}->check_pwd( $self->{user}, $self->{password} ); unless ( $res == 1 ) { - $self->lmLog( "Unable to authenticate " . $self->{user} . " !", - 'notice' ); + $self->_sub( 'userNotice', + "Unable to authenticate " . $self->{user} . " !" ); return PE_BADCREDENTIALS; } return PE_OK; diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBDBI.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBDBI.pm index c0db1c4c4..05f236171 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBDBI.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/UserDBDBI.pm @@ -62,7 +62,7 @@ sub getUser { } unless ( $self->{entry} = $sth->fetchrow_hashref() ) { - $self->lmLog( "User $user not found", 'notice' ); + $self->_sub( 'userNotice', "User $user not found" ); return PE_BADCREDENTIALS; } @@ -83,7 +83,7 @@ sub getUser { my $results; unless ( $results = $sth->fetchrow_hashref() ) { - $self->lmLog( "User $user not found", 'notice' ); + $self->_sub( 'userNotice', "User $user not found" ); return PE_BADCREDENTIALS; } diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_CAS.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_CAS.pm index 787675e78..2e046a94d 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_CAS.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_CAS.pm @@ -26,7 +26,7 @@ sub getCasSession { # Session not available if ($id) { - $self->lmLog( "CAS session $id isn't yet available", 'info' ); + $self->_sub( 'userInfo', "CAS session $id isn't yet available" ); } else { $self->lmLog( "Unable to create new CAS session: $@", 'error' ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_DBI.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_DBI.pm index ea2d473d8..14dd2200d 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_DBI.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/_DBI.pm @@ -100,7 +100,7 @@ sub check_password { return 1; } else { - $self->lmLog( "Bad password for $user", 'error' ); + $self->_sub( 'userError', "Bad password for $user" ); return 0; }