Lines 135-141
sub auth_by_code {
Link Here
|
135 |
$access_token or die "Invalid OverDrive code returned"; |
135 |
$access_token or die "Invalid OverDrive code returned"; |
136 |
$self->set_token_in_koha_session($access_token, $access_token_type); |
136 |
$self->set_token_in_koha_session($access_token, $access_token_type); |
137 |
|
137 |
|
138 |
$self->koha_patron->set({overdrive_auth_token => $auth_token})->store; |
138 |
if (my $koha_patron = $self->koha_patron) { |
|
|
139 |
$koha_patron->set({overdrive_auth_token => $auth_token})->store; |
140 |
} |
139 |
return $self->get_return_page_from_koha_session; |
141 |
return $self->get_return_page_from_koha_session; |
140 |
} |
142 |
} |
141 |
|
143 |
|
Lines 202-208
sub is_logged_in {
Link Here
|
202 |
sub auth_by_saved_token { |
204 |
sub auth_by_saved_token { |
203 |
my $self = shift; |
205 |
my $self = shift; |
204 |
|
206 |
|
205 |
my $koha_patron = $self->koha_patron; |
207 |
my $koha_patron = $self->koha_patron or return; |
|
|
208 |
|
206 |
if (my $auth_token = $koha_patron->overdrive_auth_token) { |
209 |
if (my $auth_token = $koha_patron->overdrive_auth_token) { |
207 |
my ($access_token, $access_token_type, $new_auth_token) |
210 |
my ($access_token, $access_token_type, $new_auth_token) |
208 |
= $self->client->auth_by_token($auth_token); |
211 |
= $self->client->auth_by_token($auth_token); |
Lines 224-230
sub forget {
Link Here
|
224 |
my $self = shift; |
227 |
my $self = shift; |
225 |
|
228 |
|
226 |
$self->set_token_in_koha_session("", ""); |
229 |
$self->set_token_in_koha_session("", ""); |
227 |
$self->koha_patron->set({overdrive_auth_token => undef})->store; |
230 |
if (my $koha_patron = $self->koha_patron) { |
|
|
231 |
$koha_patron->set({overdrive_auth_token => undef})->store; |
232 |
} |
228 |
} |
233 |
} |
229 |
|
234 |
|
230 |
use vars qw{$AUTOLOAD}; |
235 |
use vars qw{$AUTOLOAD}; |
231 |
- |
|
|