Added some log endpoints
This commit is contained in:
parent
8e5906f3de
commit
c967098d05
1 changed files with 4 additions and 0 deletions
|
@ -6,6 +6,7 @@ use Mojolicious::Lite;
|
||||||
use Data::UUID;
|
use Data::UUID;
|
||||||
use Devel::Dwarn;
|
use Devel::Dwarn;
|
||||||
use Mojo::JSON;
|
use Mojo::JSON;
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
# connect to database
|
# connect to database
|
||||||
use DBI;
|
use DBI;
|
||||||
|
@ -119,8 +120,11 @@ post '/token' => sub {
|
||||||
|
|
||||||
my $account = $self->get_account_by_token( $json->{token} );
|
my $account = $self->get_account_by_token( $json->{token} );
|
||||||
|
|
||||||
|
$self->app->log->debug( "Account: " . Dumper $account );
|
||||||
|
|
||||||
# TODO change to proper boolean checks
|
# TODO change to proper boolean checks
|
||||||
if ( ! defined $account || $account->{keyused} ) {
|
if ( ! defined $account || $account->{keyused} ) {
|
||||||
|
$self->app->log->info("unrecognised or preused token: [" . $json->{token} . "]");
|
||||||
return $self->render( json => {
|
return $self->render( json => {
|
||||||
success => Mojo::JSON->false,
|
success => Mojo::JSON->false,
|
||||||
message => 'Token is invalid or has already been used',
|
message => 'Token is invalid or has already been used',
|
||||||
|
|
Reference in a new issue