View | Details | Raw Unified | Return to bug 30444
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_30444-edit_SelfCheckoutByLogin_syspref.pl (+18 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "30444",
5
    description => "Edit existing system preference SelfCheckoutByLogin",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        if ( C4::Context->preference('SelfCheckoutByLogin') ) {
11
            $dbh->do(q{ UPDATE systempreferences SET value="cardnumber" WHERE variable="SelfCheckoutByLogin" });
12
        } else {
13
            $dbh->do(q{ UPDATE systempreferences SET value="username" WHERE variable="SelfCheckoutByLogin" });
14
        }
15
16
        $dbh->do(q{ UPDATE systempreferences SET options="cardnumber|username|shibboleth", type="Choice", explanation="Have patrons log in to the web-based self checkout system with their username/password, their cardnumber, or using Shibboleth" WHERE variable="SelfCheckoutByLogin" });
17
    },
18
};
(-)a/installer/data/mysql/mandatory/sysprefs.sql (-1 / +1 lines)
Lines 602-608 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
602
('SelfCheckInTimeout','120','','Define the number of seconds before the self check-in module times out.','Integer'),
602
('SelfCheckInTimeout','120','','Define the number of seconds before the self check-in module times out.','Integer'),
603
('SelfCheckInUserCSS','',NULL,'Add CSS to be included in the self check-in module in an embedded <style> tag.','free'),
603
('SelfCheckInUserCSS','',NULL,'Add CSS to be included in the self check-in module in an embedded <style> tag.','free'),
604
('SelfCheckInUserJS','',NULL,'Define custom javascript for inclusion in the self check-in module.','free'),
604
('SelfCheckInUserJS','',NULL,'Define custom javascript for inclusion in the self check-in module.','free'),
605
('SelfCheckoutByLogin','1',NULL,'Have patrons login into the web-based self checkout system with their username/password or their cardnumber','YesNo'),
605
('SelfCheckoutByLogin','username','username|cardnumber|shibboleth','Have patrons log in to the web-based self checkout system with their username/password, their cardnumber, or using Shibboleth','Choice'),
606
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
606
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
607
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
607
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
608
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
608
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-2 / +3 lines)
Lines 1110-1117 Circulation: Link Here
1110
            - Have patrons log into the web-based self checkout system with their
1110
            - Have patrons log into the web-based self checkout system with their
1111
            - pref: SelfCheckoutByLogin
1111
            - pref: SelfCheckoutByLogin
1112
              choices:
1112
              choices:
1113
                  1: username and password
1113
                  username: username and password
1114
                  0: cardnumber
1114
                  cardnumber: cardnumber
1115
                  shibboleth: Shibboleth login
1115
            - ".</br>NOTE: If using 'cardnumber' and AutoSelfCheckAllowed you should set SelfCheckAllowByIPRanges to prevent brute force attacks to gain patron information outside the library."
1116
            - ".</br>NOTE: If using 'cardnumber' and AutoSelfCheckAllowed you should set SelfCheckAllowByIPRanges to prevent brute force attacks to gain patron information outside the library."
1116
        -
1117
        -
1117
            - "Time out the current patron's web-based self checkout system login after"
1118
            - "Time out the current patron's web-based self checkout system login after"
(-)a/opac/sco/sco-main.pl (-4 / +19 lines)
Lines 33-38 use Modern::Perl; Link Here
33
use CGI qw ( -utf8 );
33
use CGI qw ( -utf8 );
34
34
35
use C4::Auth qw( in_iprange get_template_and_user checkpw );
35
use C4::Auth qw( in_iprange get_template_and_user checkpw );
36
use C4::Auth_with_shibboleth qw( shib_ok get_login_shib );
36
use C4::Circulation qw( barcodedecode AddReturn CanBookBeIssued AddIssue CanBookBeRenewed AddRenewal );
37
use C4::Circulation qw( barcodedecode AddReturn CanBookBeIssued AddIssue CanBookBeRenewed AddRenewal );
37
use C4::Reserves;
38
use C4::Reserves;
38
use C4::Output qw( output_html_with_http_headers );
39
use C4::Output qw( output_html_with_http_headers );
Lines 117-123 my $issuer = Koha::Patrons->find( $issuerid )->unblessed; Link Here
117
118
118
my $patronid = $jwt ? Koha::Token->new->decode_jwt({ token => $jwt }) : undef;
119
my $patronid = $jwt ? Koha::Token->new->decode_jwt({ token => $jwt }) : undef;
119
unless ( $patronid ) {
120
unless ( $patronid ) {
120
    if ( C4::Context->preference('SelfCheckoutByLogin') ) {
121
    if ( C4::Context->preference('SelfCheckoutByLogin') eq 'shibboleth' ) {
122
        # Do Shibboleth login
123
        my ($shib, $shib_login, $patron, $value);
124
        $shib = C4::Context->config('useshibboleth') && shib_ok();
125
        $shib_login = $shib ? get_login_shib() : undef;
126
        $patron = Koha::Patrons->find({ email => $shib_login }) if $shib_login;
127
        if ($patron) {
128
           $patronid = $patron->userid;
129
        } else {
130
          undef $patronid;
131
        }
132
    } elsif ( C4::Context->preference('SelfCheckoutByLogin') eq 'username' ) {
121
        my $dbh = C4::Context->dbh;
133
        my $dbh = C4::Context->dbh;
122
        ( undef, $patronid ) = checkpw( $dbh, $patronlogin, $patronpw );
134
        ( undef, $patronid ) = checkpw( $dbh, $patronlogin, $patronpw );
123
    }
135
    }
Lines 130-137 unless ( $patronid ) { Link Here
130
142
131
my $patron;
143
my $patron;
132
if ( $patronid ) {
144
if ( $patronid ) {
133
    Koha::Plugins->call( 'patron_barcode_transform', \$patronid );
145
    if ( C4::Context->preference('SelfCheckoutByLogin') eq 'shibboleth' ) {
134
    $patron = Koha::Patrons->find( { cardnumber => $patronid } );
146
        $patron = Koha::Patrons->find( { userid => $patronid } );
147
    } else {
148
        Koha::Plugins->call( 'patron_barcode_transform', \$patronid );
149
        $patron = Koha::Patrons->find( { cardnumber => $patronid } );
150
    }
135
}
151
}
136
152
137
my $branch = $issuer->{branchcode};
153
my $branch = $issuer->{branchcode};
138
- 

Return to bug 30444