|
Lines 48-55
is necessary.
Link Here
|
| 48 |
|
48 |
|
| 49 |
=head2 Class Methods |
49 |
=head2 Class Methods |
| 50 |
|
50 |
|
|
|
51 |
=head3 new |
| 52 |
|
| 53 |
This new method allows us to store the context which gives us |
| 54 |
access to the template vars already set. In particular this gives |
| 55 |
us access to the template vars set by C4::Auth::get_template_and_user |
| 56 |
|
| 51 |
=cut |
57 |
=cut |
| 52 |
|
58 |
|
|
|
59 |
sub new { |
| 60 |
my ( $class, $context ) = @_; |
| 61 |
bless { |
| 62 |
_CONTEXT => $context, |
| 63 |
}, $class; |
| 64 |
} |
| 65 |
|
| 66 |
|
| 53 |
sub Preference { |
67 |
sub Preference { |
| 54 |
my ( $self, $pref ) = @_; |
68 |
my ( $self, $pref ) = @_; |
| 55 |
return C4::Context->preference( $pref ); |
69 |
return C4::Context->preference( $pref ); |
|
Lines 84-87
sub Version {
Link Here
|
| 84 |
}; |
98 |
}; |
| 85 |
} |
99 |
} |
| 86 |
|
100 |
|
|
|
101 |
=head3 GenerateCSRF |
| 102 |
|
| 103 |
Generate a new CSRF token. |
| 104 |
|
| 105 |
=cut |
| 106 |
|
| 107 |
sub GenerateCSRF { |
| 108 |
my ( $self ) = @_; |
| 109 |
my $session_id = $self->{_CONTEXT}->stash->{sessionID}; |
| 110 |
return Koha::Token->new->generate_csrf({ session_id => scalar $session_id }); |
| 111 |
} |
| 112 |
|
| 87 |
1; |
113 |
1; |