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

(-)a/basket/sendbasket.pl (-8 / +1 lines)
Lines 50-68 my $email_add = $query->param('email_add'); Link Here
50
50
51
my $dbh          = C4::Context->dbh;
51
my $dbh          = C4::Context->dbh;
52
52
53
my $csrf_err;
54
if ( $email_add ) {
53
if ( $email_add ) {
55
    $csrf_err = 1 unless Koha::Token->new->check_csrf({
54
    die "Wrong CSRF token" unless Koha::Token->new->check_csrf({
56
        id     => C4::Context->userenv->{id},
55
        id     => C4::Context->userenv->{id},
57
        secret => md5_base64( C4::Context->config('pass') ),
56
        secret => md5_base64( C4::Context->config('pass') ),
58
        token  => scalar $query->param('csrf_token'),
57
        token  => scalar $query->param('csrf_token'),
59
    });
58
    });
60
}
61
62
if( $csrf_err ) {
63
    $template->param( csrf_error => 1, email_add => 1 );
64
    output_html_with_http_headers $query, $cookie, $template->output;
65
} elsif ( $email_add ) {
66
    my $email = Koha::Email->new();
59
    my $email = Koha::Email->new();
67
    my %mail = $email->create_message_headers({ to => $email_add });
60
    my %mail = $email->create_message_headers({ to => $email_add });
68
    my $comment    = $query->param('comment');
61
    my $comment    = $query->param('comment');
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/sendbasketform.tt (-4 lines)
Lines 10-19 Link Here
10
        <p>The cart was sent to: [% email_add |html %]</p>
10
        <p>The cart was sent to: [% email_add |html %]</p>
11
		<p><a class="focus close" href="#">Close window</a></p>
11
		<p><a class="focus close" href="#">Close window</a></p>
12
	[% END %]
12
	[% END %]
13
    [% IF csrf_error %]
14
        <p>No valid CSRF token!</p>
15
        <p><a class="focus close" href="#">Close window</a></p>
16
    [% END %]
17
	[% IF ( error ) %]
13
	[% IF ( error ) %]
18
	<p>Problem sending the cart...</p>
14
	<p>Problem sending the cart...</p>
19
	[% END %]
15
	[% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasketform.tt (-4 lines)
Lines 19-28 Link Here
19
                                <p><a class="focus close" href="#">Close window</a></p>
19
                                <p><a class="focus close" href="#">Close window</a></p>
20
                            [% END %]
20
                            [% END %]
21
21
22
                            [% IF csrf_error %]
23
                                <p>No valid CSRF token!</p>
24
                                <p><a class="focus close" href="#">Close window</a></p>
25
                            [% END %]
26
                            [% IF ( error ) %]
22
                            [% IF ( error ) %]
27
                                <div class="alert">
23
                                <div class="alert">
28
                                    <p>There was an error sending the cart.</p>
24
                                    <p>There was an error sending the cart.</p>
(-)a/opac/opac-sendbasket.pl (-9 / +1 lines)
Lines 52-70 my $email_add = $query->param('email_add'); Link Here
52
52
53
my $dbh          = C4::Context->dbh;
53
my $dbh          = C4::Context->dbh;
54
54
55
my $csrf_err;
56
if ( $email_add ) {
55
if ( $email_add ) {
57
    $csrf_err = 1 unless Koha::Token->new->check_csrf({
56
    die "Wrong CSRF token" unless Koha::Token->new->check_csrf({
58
        id     => C4::Context->userenv->{id},
57
        id     => C4::Context->userenv->{id},
59
        secret => md5_base64( C4::Context->config('pass') ),
58
        secret => md5_base64( C4::Context->config('pass') ),
60
        token  => scalar $query->param('csrf_token'),
59
        token  => scalar $query->param('csrf_token'),
61
    });
60
    });
62
}
63
64
if( $csrf_err ) {
65
    $template->param( csrf_error => 1, email_add => 1 );
66
    output_html_with_http_headers $query, $cookie, $template->output;
67
} elsif ( $email_add ) {
68
    my $email = Koha::Email->new();
61
    my $email = Koha::Email->new();
69
    my $user = GetMember(borrowernumber => $borrowernumber);
62
    my $user = GetMember(borrowernumber => $borrowernumber);
70
    my $user_email = GetFirstValidEmailAddress($borrowernumber)
63
    my $user_email = GetFirstValidEmailAddress($borrowernumber)
71
- 

Return to bug 17109