Fixed upload test and controller after updates to session key usage
This commit is contained in:
parent
f01a7a9439
commit
110a051a4e
3 changed files with 42 additions and 15 deletions
|
@ -1,7 +1,7 @@
|
|||
package Pear::LocalLoop::Controller::Api::Auth;
|
||||
use Mojo::Base 'Mojolicious::Controller';
|
||||
use Data::Dumper;
|
||||
use Mojo::JSON;
|
||||
use Mojo::JSON qw/ decode_json /;
|
||||
|
||||
has error_messages => sub {
|
||||
return {
|
||||
|
@ -20,6 +20,15 @@ sub auth {
|
|||
|
||||
my $session_key = $c->req->json( '/session_key' );
|
||||
|
||||
unless ( defined $session_key ) {
|
||||
# Upload doesnt quite use json correctly....
|
||||
my $json = $c->param('json');
|
||||
if ( defined $json ) {
|
||||
$json = decode_json( $json );
|
||||
$session_key = $json->{session_key};
|
||||
}
|
||||
}
|
||||
|
||||
my $session_result = $c->schema->resultset('SessionToken')->find({ sessiontokenname => $session_key });
|
||||
|
||||
if ( defined $session_result ) {
|
||||
|
|
|
@ -38,7 +38,7 @@ The name of an organisation. Used when transactionAdditionType is 3.
|
|||
sub post_upload {
|
||||
my $self = shift;
|
||||
|
||||
my $userId = $self->get_active_user_id();
|
||||
my $userId = $self->stash->{api_user}->id;
|
||||
|
||||
my $json = $self->param('json');
|
||||
if ( ! defined $json ) {
|
||||
|
|
Reference in a new issue