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

(-)a/C4/Auth.pm (-1 / +2 lines)
Lines 997-1003 sub checkauth { Link Here
997
            my ( $return, $cardnumber );
997
            my ( $return, $cardnumber );
998
998
999
            # If shib is enabled and we have a shib login, does the login match a valid koha user
999
            # If shib is enabled and we have a shib login, does the login match a valid koha user
1000
            if ( $shib && $shib_login ) {
1000
            if ( $shib && $shib_login && !$query->param('password')) {
1001
                my $retuserid;
1001
                my $retuserid;
1002
1002
1003
                # Do not pass password here, else shib will not be checked in checkpw.
1003
                # Do not pass password here, else shib will not be checked in checkpw.
Lines 1096-1101 sub checkauth { Link Here
1096
                    (
1096
                    (
1097
                        ( $type eq 'opac' )
1097
                        ( $type eq 'opac' )
1098
                        && C4::Context->preference('OPACShibOnly')
1098
                        && C4::Context->preference('OPACShibOnly')
1099
			&& C4::Context->preference('SelfCheckoutByLogin') ne 'shibboleth'
1099
                    )
1100
                    )
1100
                    || ( ( $type ne 'opac' )
1101
                    || ( ( $type ne 'opac' )
1101
                        && C4::Context->preference('staffShibOnly') )
1102
                        && C4::Context->preference('staffShibOnly') )
(-)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 606-612 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
606
('SelfCheckInTimeout','120','','Define the number of seconds before the self check-in module times out.','Integer'),
606
('SelfCheckInTimeout','120','','Define the number of seconds before the self check-in module times out.','Integer'),
607
('SelfCheckInUserCSS','',NULL,'Add CSS to be included in the self check-in module in an embedded <style> tag.','free'),
607
('SelfCheckInUserCSS','',NULL,'Add CSS to be included in the self check-in module in an embedded <style> tag.','free'),
608
('SelfCheckInUserJS','',NULL,'Define custom javascript for inclusion in the self check-in module.','free'),
608
('SelfCheckInUserJS','',NULL,'Define custom javascript for inclusion in the self check-in module.','free'),
609
('SelfCheckoutByLogin','1',NULL,'Have patrons login into the web-based self checkout system with their username/password or their cardnumber','YesNo'),
609
('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'),
610
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
610
('SelfCheckReceiptPrompt','1','NULL','If ON, print receipt dialog pops up when self checkout is finished','YesNo'),
611
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
611
('SelfCheckTimeout','120','','Define the number of seconds before the Web-based Self Checkout times out a patron','Integer'),
612
('SendAllEmailsTo','',NULL,'All emails will be redirected to this email if it is not empty','free'),
612
('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 / +21 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
        my $shib_config = C4::Context->config('shibboleth');
125
        $shib = C4::Context->config('useshibboleth') && shib_ok();
126
        $shib_login = $shib ? get_login_shib() : undef;
127
        my $match_point = $shib_config->{matchpoint};
128
        $patron = Koha::Patrons->find({ $match_point => $shib_login }) if $shib_login;
129
        if ($patron) {
130
           $patronid = $patron->userid;
131
        } else {
132
          undef $patronid;
133
        }
134
    } elsif ( C4::Context->preference('SelfCheckoutByLogin') eq 'username' ) {
121
        my $dbh = C4::Context->dbh;
135
        my $dbh = C4::Context->dbh;
122
        ( undef, $patronid ) = checkpw( $dbh, $patronlogin, $patronpw );
136
        ( undef, $patronid ) = checkpw( $dbh, $patronlogin, $patronpw );
123
    }
137
    }
Lines 130-137 unless ( $patronid ) { Link Here
130
144
131
my $patron;
145
my $patron;
132
if ( $patronid ) {
146
if ( $patronid ) {
133
    Koha::Plugins->call( 'patron_barcode_transform', \$patronid );
147
    if ( C4::Context->preference('SelfCheckoutByLogin') eq 'shibboleth' ) {
134
    $patron = Koha::Patrons->find( { cardnumber => $patronid } );
148
        $patron = Koha::Patrons->find( { userid => $patronid } );
149
    } else {
150
        Koha::Plugins->call( 'patron_barcode_transform', \$patronid );
151
        $patron = Koha::Patrons->find( { cardnumber => $patronid } );
152
    }
135
}
153
}
136
154
137
undef $jwt unless $patron;
155
undef $jwt unless $patron;
138
- 

Return to bug 30444