Skip to content

Commit

Permalink
BWS-PKG - Bug 34545: Koha should die with an error if AutoSelfCheckID…
Browse files Browse the repository at this point in the history
… is invalid

If AutoSelfCheckID is an not valid ( either by deleting the patron or by changing the patron's userid ), self-checkout will display the login screen and no error will be generated in any logs.

Test Plan:
1) Apply this patch
2) Verify AutoSelfCheckID is working as expected
3) Change AutoSelfCheckID to an invalid userid
4) Restart all the things!
5) Verify visiting sco-main.pl generates an error!
  • Loading branch information
kylemhall committed Jun 3, 2024
1 parent ab47ef8 commit 4a8b586
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions C4/Auth.pm
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ sub get_template_and_user {
if ( C4::Context->preference('AutoSelfCheckAllowed') && $in->{template_name} =~ m|sco/| ) {
my $AutoSelfCheckID = C4::Context->preference('AutoSelfCheckID');
my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass');

die "Cannot auto login to self checkout, user $AutoSelfCheckID does not exist!"
unless Koha::Patrons->search( { userid => $AutoSelfCheckID } )->count();

$in->{query}->param( -name => 'login_userid', -values => [$AutoSelfCheckID] );
$in->{query}->param( -name => 'login_password', -values => [$AutoSelfCheckPass] );
$in->{query}->param( -name => 'koha_login_context', -values => ['sco'] );
Expand Down

0 comments on commit 4a8b586

Please sign in to comment.