my $self = shift;
my $e = $self->editor;
-
my $stat = $self->_load_user_with_prefs;
return $stat if $stat;
}
#determine which message to show (if any)
+ my $cache = OpenSRF::Utils::Cache->new('global');
+ $cache->put_cache('account_renew_ok','false',3600);
+
if ($ctx->{hastemprenew} eq 1) { #user already has active temp renewal
$ctx->{account_renew_message} = '<div style="border:2px solid green;padding:5px;">Your account
could only be temporarily renewed because your address changed. Please visit your nearest PINES
} else {
$ctx->{account_renew_message} = '<span class="light_border"><a class="btn btn-sm btn-action"
href="/eg/opac/renew-account"><i class="fas fa-user-cog"></i>Click here to renew your account</a></span>';
+ $cache->put_cache('account_renew_ok','true',3600);
}
return 1;
use OpenSRF::Utils::JSON;
use OpenSRF::Utils qw/:datetime/;
use OpenILS::Utils::Fieldmapper;
+use OpenSRF::Utils::Cache;
use OpenILS::Application::AppUtils;
use OpenILS::Utils::CStoreEditor qw/:funcs/;
use OpenILS::Event;
$msg .= "|" if $msg;
$msg .= "$p=".$cgi->param($p);
}
- $logger->info("ECARD: Submit params: $msg");
-#TERRAN - dump out all incoming stuff from form
-$logger->error("TERRAN - all incoming params: $msg");
+ $logger->info("ECARD: Submit params: $msg");
}
sub handle_testmode_api {
}
sub load_ecard_submit {
-
my $self = shift;
my $ctx = $self->ctx;
my $cgi = $self->cgi;
$update_type = 'register';
}
+ #If this is a renewal, double-check that they are eligible to renew
+ my $cache = OpenSRF::Utils::Cache->new('global');
+ if ($update_type eq 'renew') {
+ if ($cache->get_cache("account_renew_ok") && $cache->get_cache("account_renew_ok") eq 'true') {
+ } else {
+ $logger->error("ERENEW - User not in correct status to renew account");
+ return $self->compile_response;
+ }
+ }
+
$self->log_params;
my $testmode = $cgi->param('testmode') || '';
} else {
$ctx->{response}->{temp_renew} = 0;
}
+ #set renewal flag in cache to false to prevent user from refreshing the page and submitting again
+ $cache->put_cache('account_renew_ok','false',3600);
} else {
$ctx->{response}->{barcode} = $ctx->{user}->card->barcode;
}
$ctx->{response} = OpenSRF::Utils::JSON->perl2JSON($ctx->{response});
$logger->info("ECARD responding with " . $ctx->{response});
-#TERRAN TEST
- $logger->error("TERRAN - response being sent to Quipu is: " . $ctx->{response});
-
return Apache2::Const::OK;
}