diff --git a/lib/Lufi.pm b/lib/Lufi.pm index 605c5c3..a36d0dc 100644 --- a/lib/Lufi.pm +++ b/lib/Lufi.pm @@ -97,10 +97,13 @@ sub startup { ); if ($mesg->code) { - $c->app->log->error($mesg->error); + $c->app->log->info("[LDAP authentication failed] login: $username, IP: ".$c->ip); + $c->app->log->error("[LDAP authentication failed] ".$mesg->error); return undef; } + $c->app->log->info("[LDAP authentication successful] login: $username, IP: ".$c->ip); + return $username; } } diff --git a/lib/Lufi/Controller/Files.pm b/lib/Lufi/Controller/Files.pm index 1f845a2..65ae95a 100644 --- a/lib/Lufi/Controller/Files.pm +++ b/lib/Lufi/Controller/Files.pm @@ -75,9 +75,13 @@ sub upload { $delay = ($json->{delay} <= $c->max_delay || $c->max_delay == 0) ? $json->{delay} : $c->max_delay; } + my $creator = $c->ip; + if (defined($c->config('ldap'))) { + $creator = 'User: '.$c->current_user.', IP: '.$creator; + } $f = Lufi::File->new( record => $c->get_empty, - created_by => $c->ip, + created_by => $creator, delete_at_first_view => ($json->{del_at_first_view}) ? 1 : 0, delete_at_day => $delay, mediatype => $json->{type},