From 2d03d25916cabb2d75cb6fa75132c107f39e67f5 Mon Sep 17 00:00:00 2001 From: Thomas Bloor Date: Wed, 21 Mar 2018 17:24:13 +0000 Subject: [PATCH 1/4] Set secrets with decent default for production --- lib/Pear/LocalLoop.pm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Pear/LocalLoop.pm b/lib/Pear/LocalLoop.pm index c996567..db7bba8 100644 --- a/lib/Pear/LocalLoop.pm +++ b/lib/Pear/LocalLoop.pm @@ -34,6 +34,13 @@ sub startup { }); my $config = $self->config; + if ( defined $config->{secret} ) { + $self->secrets([ $config->{secret} ]); + } elsif ( $self->mode eq 'production' ) { + # Just incase we end up in production and it hasnt been set! + $self->secrets([ Data::UUID->new->create() ]); + } + push @{ $self->commands->namespaces }, __PACKAGE__ . '::Command'; $self->plugin('Pear::LocalLoop::Plugin::BootstrapPagination', { bootstrap4 => 1 } ); @@ -247,9 +254,9 @@ sub startup { # $portal_api->post('/search')->to('api-upload#post_search'); $self->hook( before_dispatch => sub { - my $self = shift; + my $c = shift; - $self->res->headers->header('Access-Control-Allow-Origin' => '*') if $self->app->mode eq 'development'; + $c->res->headers->header('Access-Control-Allow-Origin' => '*') if $c->app->mode eq 'development'; }); $self->helper( copy_transactions_and_delete => sub { From 2b5bb9cd8cd4ed5810582467891056b5fb998aee Mon Sep 17 00:00:00 2001 From: Thomas Bloor Date: Wed, 21 Mar 2018 17:24:41 +0000 Subject: [PATCH 2/4] Stop error on large csv exceeding size of cookies --- lib/Pear/LocalLoop/Controller/Admin/Import.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Pear/LocalLoop/Controller/Admin/Import.pm b/lib/Pear/LocalLoop/Controller/Admin/Import.pm index 0416012..630bf84 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Import.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Import.pm @@ -144,7 +144,8 @@ sub _csv_flash_error { $c->flash( error => $error, - csv_data => $c->param('csv'), + # If csv info is huge, this fails epically + #csv_data => $c->param('csv'), date_format => $c->param('date_format'), ); } From 2286e541049bba466be3885f15bdd311f37ef091 Mon Sep 17 00:00:00 2001 From: Thomas Bloor Date: Wed, 21 Mar 2018 17:24:55 +0000 Subject: [PATCH 3/4] Allow for parsing currency without a currency sign in front --- lib/Pear/LocalLoop/Plugin/Currency.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Pear/LocalLoop/Plugin/Currency.pm b/lib/Pear/LocalLoop/Plugin/Currency.pm index f256f80..fa5333f 100644 --- a/lib/Pear/LocalLoop/Plugin/Currency.pm +++ b/lib/Pear/LocalLoop/Plugin/Currency.pm @@ -9,6 +9,8 @@ sub register { my $value; if ( $currency_string =~ /^£([\d.]+)/ ) { $value = $1 * 1; + } elsif ( $currency_string =~ /^([\d.]+)/ ) { + $value = $1 * 1; } return $value; }); From 8a2aa3a73a09666edc8d0b163691b2a8da608d2f Mon Sep 17 00:00:00 2001 From: Thomas Bloor Date: Wed, 21 Mar 2018 17:49:00 +0000 Subject: [PATCH 4/4] Update changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb8bb99..a033783 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ # Next Release +* **Admin Fix** Parse currency without a currency symbol on import +* **Admin Fix** Fix large CSV issue on import +* Use custom secrets for encryption + # v0.10.6 * Fixed organisation submission