Skip to content

Commit

Permalink
(#630) Add logging for login attempts/successes
Browse files Browse the repository at this point in the history
  • Loading branch information
Difegue committed Jun 7, 2022
1 parent 3c62848 commit b811f76
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/LANraragi/Controller/Login.pm
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@ sub check {
my $ppr = Authen::Passphrase->from_rfc2307( $self->LRR_CONF->get_password );

if ( $ppr->match($pw) ) {

$self->LRR_LOGGER->info( "Successful login attempt from " . $self->tx->remote_address );

$self->session( is_logged => 1 );
$self->session( expiration => 60 * 60 * 24 );
$self->redirect_to('index');
} else {

$self->LRR_LOGGER->warn( "Failed login attempt with password '$pw' from " . $self->tx->remote_address );

$self->render(
template => "login",
title => $self->LRR_CONF->get_htmltitle,
Expand Down Expand Up @@ -50,7 +56,7 @@ sub logged_in_api {
# The API key is in the Authentication header.
my $expected_key = $self->LRR_CONF->get_apikey;

my $auth_header = $self->req->headers->authorization || "";
my $auth_header = $self->req->headers->authorization || "";
my $expected_header = "Bearer " . encode_base64( $expected_key, "" );

return 1
Expand Down

0 comments on commit b811f76

Please sign in to comment.