Fix #50 Add users infos in log and db if using ldap

This commit is contained in:
Luc Didry 2016-06-14 10:31:43 +02:00 committed by Luc Didry
parent 6f3cf342ac
commit 3bbe8000d3
2 changed files with 9 additions and 2 deletions

View File

@ -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;
}
}

View File

@ -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},