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

(-)a/Koha/Acquisition/Bookseller/Interface.pm (-1 / +2 lines)
Lines 16-21 package Koha::Acquisition::Bookseller::Interface; Link Here
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
use Encode qw(decode_utf8);
19
use Koha::Encryption;
20
use Koha::Encryption;
20
21
21
use base qw( Koha::Object );
22
use base qw( Koha::Object );
Lines 58-64 Decrypt the password and return its plain text form. Link Here
58
59
59
sub plain_text_password {
60
sub plain_text_password {
60
    my ($self) = @_;
61
    my ($self) = @_;
61
    return Koha::Encryption->new->decrypt_hex( $self->password )
62
    return decode_utf8( Koha::Encryption->new->decrypt_hex( $self->password ) )
62
        if $self->password;
63
        if $self->password;
63
}
64
}
64
65
(-)a/t/db_dependent/Koha/Acquisition/Booksellers.t (-6 / +6 lines)
Lines 17-22 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use utf8;
20
use Test::More tests => 8;
21
use Test::More tests => 8;
21
22
22
use t::lib::TestBuilder;
23
use t::lib::TestBuilder;
Lines 218-224 subtest 'interfaces' => sub { Link Here
218
    is( $interfaces->count, 2,                                           '2 interfaces stored' );
219
    is( $interfaces->count, 2,                                           '2 interfaces stored' );
219
    is( ref($interfaces),   'Koha::Acquisition::Bookseller::Interfaces', 'Type is correct' );
220
    is( ref($interfaces),   'Koha::Acquisition::Bookseller::Interfaces', 'Type is correct' );
220
221
221
    $vendor->interfaces( [ { name => 'first interface', login => 'one_login', password => 'oneP@sswOrd' } ] );
222
    $vendor->interfaces( [ { name => 'first interface', login => 'one_login', password => 'oneP@sswOrd❤' } ] );
222
    $vendor     = $vendor->get_from_storage;
223
    $vendor     = $vendor->get_from_storage;
223
    $interfaces = $vendor->interfaces;
224
    $interfaces = $vendor->interfaces;
224
    is( $interfaces->count, 1, '1 interface stored' );
225
    is( $interfaces->count, 1, '1 interface stored' );
Lines 226-235 subtest 'interfaces' => sub { Link Here
226
    is( $interface->name,  'first interface', 'name correctly saved' );
227
    is( $interface->name,  'first interface', 'name correctly saved' );
227
    is( $interface->login, 'one_login',       'login correctly saved' );
228
    is( $interface->login, 'one_login',       'login correctly saved' );
228
    is( $interface->uri,   undef,             'no value is stored as NULL' );
229
    is( $interface->uri,   undef,             'no value is stored as NULL' );
229
    isnt( $interface->password, 'oneP@sswOrd', 'Password is not stored in plain text' );
230
    isnt( $interface->password, 'oneP@sswOrd❤', 'Password is not stored in plain text' );
230
    isnt( $interface->password, '',            'Password is not removed' );
231
    isnt( $interface->password, '',             'Password is not removed' );
231
    isnt( $interface->password, undef,         'Password is not set to NULL' );
232
    isnt( $interface->password, undef,          'Password is not set to NULL' );
232
    is( $interface->plain_text_password, 'oneP@sswOrd', 'Password can be retrieved using ->plain_text_password' );
233
    is( $interface->plain_text_password, 'oneP@sswOrd❤', 'Password can be retrieved using ->plain_text_password' );
233
234
234
    $schema->storage->txn_rollback();
235
    $schema->storage->txn_rollback();
235
};
236
};
236
- 

Return to bug 39826