|
Lines 36-41
use Koha::CirculationRules;
Link Here
|
| 36 |
use Koha::Club::Enrollments; |
36 |
use Koha::Club::Enrollments; |
| 37 |
use Koha::Database; |
37 |
use Koha::Database; |
| 38 |
use Koha::DateUtils qw( dt_from_string ); |
38 |
use Koha::DateUtils qw( dt_from_string ); |
|
|
39 |
use Koha::Encryption; |
| 39 |
use Koha::Exceptions::Password; |
40 |
use Koha::Exceptions::Password; |
| 40 |
use Koha::Holds; |
41 |
use Koha::Holds; |
| 41 |
use Koha::Old::Checkouts; |
42 |
use Koha::Old::Checkouts; |
|
Lines 2131-2136
sub can_patron_change_staff_only_lists {
Link Here
|
| 2131 |
return 0; |
2132 |
return 0; |
| 2132 |
} |
2133 |
} |
| 2133 |
|
2134 |
|
|
|
2135 |
=head3 |
| 2136 |
|
| 2137 |
$patron->encode_secret($secret32); |
| 2138 |
|
| 2139 |
Secret (TwoFactorAuth expects it in base32 format) is encrypted. |
| 2140 |
You still need to call ->store. |
| 2141 |
|
| 2142 |
=cut |
| 2143 |
|
| 2144 |
sub encode_secret { |
| 2145 |
my ( $self, $secret ) = @_; |
| 2146 |
if( $secret ) { |
| 2147 |
return $self->secret( Koha::Encryption->new->encrypt_hex($secret) ); |
| 2148 |
} |
| 2149 |
return $self->secret($secret); |
| 2150 |
} |
| 2151 |
|
| 2152 |
=head3 |
| 2153 |
|
| 2154 |
my $secret32 = $patron->decoded_secret; |
| 2155 |
|
| 2156 |
Decode the patron secret. We expect to get back a base32 string, but this |
| 2157 |
is not checked here. Caller of encode_secret is responsible for that. |
| 2158 |
|
| 2159 |
=cut |
| 2160 |
|
| 2161 |
sub decoded_secret { |
| 2162 |
my ( $self ) = @_; |
| 2163 |
if( $self->secret ) { |
| 2164 |
return Koha::Encryption->new->decrypt_hex( $self->secret ); |
| 2165 |
} |
| 2166 |
return $self->secret; |
| 2167 |
} |
| 2168 |
|
| 2134 |
=head2 Internal methods |
2169 |
=head2 Internal methods |
| 2135 |
|
2170 |
|
| 2136 |
=head3 _type |
2171 |
=head3 _type |