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

(-)a/basket/sendbasket.pl (-2 / +2 lines)
Lines 52-58 my $dbh = C4::Context->dbh; Link Here
52
52
53
if ( $email_add ) {
53
if ( $email_add ) {
54
    die "Wrong CSRF token" unless Koha::Token->new->check_csrf({
54
    die "Wrong CSRF token" unless Koha::Token->new->check_csrf({
55
        id     => C4::Context->userenv->{id},
55
        id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
56
        secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
56
        secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
57
        token  => scalar $query->param('csrf_token'),
57
        token  => scalar $query->param('csrf_token'),
58
    });
58
    });
Lines 177-183 else { Link Here
177
        suggestion     => C4::Context->preference("suggestion"),
177
        suggestion     => C4::Context->preference("suggestion"),
178
        virtualshelves => C4::Context->preference("virtualshelves"),
178
        virtualshelves => C4::Context->preference("virtualshelves"),
179
        csrf_token     => Koha::Token->new->generate_csrf(
179
        csrf_token     => Koha::Token->new->generate_csrf(
180
            {   id     => C4::Context->userenv->{id},
180
            {   id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
181
                secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
181
                secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
182
            }
182
            }
183
        ),
183
        ),
(-)a/members/deletemem.pl (-2 / +2 lines)
Lines 148-154 if ( $op eq 'delete_confirm' or $countissues > 0 or $flags->{'CHARGES'} or $is_ Link Here
148
        $template->param(
148
        $template->param(
149
            op         => 'delete_confirm',
149
            op         => 'delete_confirm',
150
            csrf_token => Koha::Token->new->generate_csrf(
150
            csrf_token => Koha::Token->new->generate_csrf(
151
                {   id     => C4::Context->userenv->{id},
151
                {   id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
152
                    secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
152
                    secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
153
                }
153
                }
154
            ),
154
            ),
Lines 158-164 if ( $op eq 'delete_confirm' or $countissues > 0 or $flags->{'CHARGES'} or $is_ Link Here
158
158
159
    die "Wrong CSRF token"
159
    die "Wrong CSRF token"
160
        unless Koha::Token->new->check_csrf({
160
        unless Koha::Token->new->check_csrf({
161
            id     => C4::Context->userenv->{id},
161
            id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
162
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
162
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
163
            token  => scalar $input->param('csrf_token'),
163
            token  => scalar $input->param('csrf_token'),
164
        });
164
        });
(-)a/members/member-password.pl (-2 / +2 lines)
Lines 69-75 if ( $newpassword && !scalar(@errors) ) { Link Here
69
69
70
    die "Wrong CSRF token"
70
    die "Wrong CSRF token"
71
        unless Koha::Token->new->check_csrf({
71
        unless Koha::Token->new->check_csrf({
72
            id     => C4::Context->userenv->{id},
72
            id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
73
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
73
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
74
            token  => scalar $input->param('csrf_token'),
74
            token  => scalar $input->param('csrf_token'),
75
        });
75
        });
Lines 151-157 $template->param( Link Here
151
    minPasswordLength          => $minpw,
151
    minPasswordLength          => $minpw,
152
    RoutingSerials             => C4::Context->preference('RoutingSerials'),
152
    RoutingSerials             => C4::Context->preference('RoutingSerials'),
153
    csrf_token                 => Koha::Token->new->generate_csrf({
153
    csrf_token                 => Koha::Token->new->generate_csrf({
154
        id     => C4::Context->userenv->{id},
154
        id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
155
        secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
155
        secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
156
    }),
156
    }),
157
);
157
);
(-)a/members/memberentry.pl (-2 / +2 lines)
Lines 290-296 if ($op eq 'save' || $op eq 'insert'){ Link Here
290
290
291
    die "Wrong CSRF token"
291
    die "Wrong CSRF token"
292
        unless Koha::Token->new->check_csrf({
292
        unless Koha::Token->new->check_csrf({
293
            id     => C4::Context->userenv->{id},
293
            id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
294
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
294
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
295
            token  => scalar $input->param('csrf_token'),
295
            token  => scalar $input->param('csrf_token'),
296
        });
296
        });
Lines 753-759 $template->param( Link Here
753
# Generate CSRF token
753
# Generate CSRF token
754
$template->param(
754
$template->param(
755
    csrf_token => Koha::Token->new->generate_csrf(
755
    csrf_token => Koha::Token->new->generate_csrf(
756
        {   id     => C4::Context->userenv->{id},
756
        {   id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
757
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
757
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
758
        }
758
        }
759
    ),
759
    ),
(-)a/members/moremember.pl (-1 / +1 lines)
Lines 273-279 $template->param( picture => 1 ) if $patron_image; Link Here
273
# Generate CSRF token for upload and delete image buttons
273
# Generate CSRF token for upload and delete image buttons
274
$template->param(
274
$template->param(
275
    csrf_token => Koha::Token->new->generate_csrf({
275
    csrf_token => Koha::Token->new->generate_csrf({
276
        id     => C4::Context->userenv->{id},
276
        id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
277
        secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
277
        secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
278
    }),
278
    }),
279
);
279
);
(-)a/opac/opac-memberentry.pl (-4 / +4 lines)
Lines 200-206 elsif ( $action eq 'update' ) { Link Here
200
    my $borrower = GetMember( borrowernumber => $borrowernumber );
200
    my $borrower = GetMember( borrowernumber => $borrowernumber );
201
    die "Wrong CSRF token"
201
    die "Wrong CSRF token"
202
        unless Koha::Token->new->check_csrf({
202
        unless Koha::Token->new->check_csrf({
203
            id     => $borrower->{userid},
203
            id     => Encode::encode( 'UTF-8', $borrower->{userid} ),
204
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
204
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
205
            token  => scalar $cgi->param('csrf_token'),
205
            token  => scalar $cgi->param('csrf_token'),
206
        });
206
        });
Lines 221-227 elsif ( $action eq 'update' ) { Link Here
221
            invalid_form_fields    => $invalidformfields,
221
            invalid_form_fields    => $invalidformfields,
222
            borrower               => \%borrower,
222
            borrower               => \%borrower,
223
            csrf_token             => Koha::Token->new->generate_csrf({
223
            csrf_token             => Koha::Token->new->generate_csrf({
224
                id     => $borrower->{userid},
224
                id     => Encode::encode( 'UTF-8', $borrower->{userid} ),
225
                secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
225
                secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
226
            }),
226
            }),
227
        );
227
        );
Lines 262-268 elsif ( $action eq 'update' ) { Link Here
262
                nochanges => 1,
262
                nochanges => 1,
263
                borrower => GetMember( borrowernumber => $borrowernumber ),
263
                borrower => GetMember( borrowernumber => $borrowernumber ),
264
                csrf_token => Koha::Token->new->generate_csrf({
264
                csrf_token => Koha::Token->new->generate_csrf({
265
                    id     => $borrower->{userid},
265
                    id     => Encode::encode( 'UTF-8', $borrower->{userid} ),
266
                    secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
266
                    secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
267
                }),
267
                }),
268
            );
268
            );
Lines 285-291 elsif ( $action eq 'edit' ) { #Display logged in borrower's data Link Here
285
        guarantor => scalar Koha::Patrons->find($borrowernumber)->guarantor(),
285
        guarantor => scalar Koha::Patrons->find($borrowernumber)->guarantor(),
286
        hidden => GetHiddenFields( $mandatory, 'modification' ),
286
        hidden => GetHiddenFields( $mandatory, 'modification' ),
287
        csrf_token => Koha::Token->new->generate_csrf({
287
        csrf_token => Koha::Token->new->generate_csrf({
288
            id     => $borrower->{userid},
288
            id     => Encode::encode( 'UTF-8', $borrower->{userid} ),
289
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
289
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
290
        }),
290
        }),
291
    );
291
    );
(-)a/opac/opac-sendbasket.pl (-2 / +2 lines)
Lines 54-60 my $dbh = C4::Context->dbh; Link Here
54
54
55
if ( $email_add ) {
55
if ( $email_add ) {
56
    die "Wrong CSRF token" unless Koha::Token->new->check_csrf({
56
    die "Wrong CSRF token" unless Koha::Token->new->check_csrf({
57
        id     => C4::Context->userenv->{id},
57
        id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
58
        secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
58
        secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
59
        token  => scalar $query->param('csrf_token'),
59
        token  => scalar $query->param('csrf_token'),
60
    });
60
    });
Lines 197-203 else { Link Here
197
        suggestion     => C4::Context->preference("suggestion"),
197
        suggestion     => C4::Context->preference("suggestion"),
198
        virtualshelves => C4::Context->preference("virtualshelves"),
198
        virtualshelves => C4::Context->preference("virtualshelves"),
199
        csrf_token     => Koha::Token->new->generate_csrf(
199
        csrf_token     => Koha::Token->new->generate_csrf(
200
            {   id     => C4::Context->userenv->{id},
200
            {   id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
201
                secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
201
                secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
202
            }
202
            }
203
        ),
203
        ),
(-)a/tools/import_borrowers.pl (-2 / +2 lines)
Lines 112-118 $template->param( SCRIPT_NAME => '/cgi-bin/koha/tools/import_borrowers.pl' ); Link Here
112
if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
112
if ( $uploadborrowers && length($uploadborrowers) > 0 ) {
113
    die "Wrong CSRF token"
113
    die "Wrong CSRF token"
114
        unless Koha::Token->new->check_csrf({
114
        unless Koha::Token->new->check_csrf({
115
            id     => C4::Context->userenv->{id},
115
            id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
116
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
116
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
117
            token  => scalar $input->param('csrf_token'),
117
            token  => scalar $input->param('csrf_token'),
118
        });
118
        });
Lines 391-397 if ( $uploadborrowers && length($uploadborrowers) > 0 ) { Link Here
391
391
392
    $template->param(
392
    $template->param(
393
        csrf_token => Koha::Token->new->generate_csrf(
393
        csrf_token => Koha::Token->new->generate_csrf(
394
            {   id     => C4::Context->userenv->{id},
394
            {   id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
395
                secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
395
                secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
396
            }
396
            }
397
        ),
397
        ),
(-)a/tools/picture-upload.pl (-4 / +3 lines)
Lines 88-94 if ( ( $op eq 'Upload' ) && $uploadfile ) { Link Here
88
88
89
    die "Wrong CSRF token"
89
    die "Wrong CSRF token"
90
        unless Koha::Token->new->check_csrf({
90
        unless Koha::Token->new->check_csrf({
91
            id     => C4::Context->userenv->{id},
91
            id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
92
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
92
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
93
            token  => scalar $input->param('csrf_token'),
93
            token  => scalar $input->param('csrf_token'),
94
        });
94
        });
Lines 176-182 elsif ( ( $op eq 'Upload' ) && !$uploadfile ) { Link Here
176
elsif ( $op eq 'Delete' ) {
176
elsif ( $op eq 'Delete' ) {
177
    die "Wrong CSRF token"
177
    die "Wrong CSRF token"
178
        unless Koha::Token->new->check_csrf({
178
        unless Koha::Token->new->check_csrf({
179
            id     => C4::Context->userenv->{id},
179
            id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
180
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
180
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
181
            token  => scalar $input->param('csrf_token'),
181
            token  => scalar $input->param('csrf_token'),
182
        });
182
        });
Lines 195-201 if ( $borrowernumber && !%errors && !$template->param('ERRORS') ) { Link Here
195
else {
195
else {
196
    $template->param(
196
    $template->param(
197
        csrf_token => Koha::Token->new->generate_csrf({
197
        csrf_token => Koha::Token->new->generate_csrf({
198
            id     => C4::Context->userenv->{id},
198
            id     => Encode::encode( 'UTF-8', C4::Context->userenv->{id} ),
199
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
199
            secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ),
200
        }),
200
        }),
201
    );
201
    );
202
- 

Return to bug 17830