From 6a5e5c7c0ea37b7e233bb74ee1dc88def1801ecb Mon Sep 17 00:00:00 2001 From: root Date: Tue, 7 May 2019 18:01:45 +0000 Subject: [PATCH] Bug 22478: (follow-up) [18.05.X ONLY] Fix rebase and fix selenium opac_auth We missed a case or two in the backport, also picked changes from https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=76414&action=diff in order to fix opac auth in selenium --- t/db_dependent/selenium/regressions.t | 7 +++++-- t/lib/Selenium.pm | 5 ++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/selenium/regressions.t b/t/db_dependent/selenium/regressions.t index cba2bf0f45..68a121b890 100644 --- a/t/db_dependent/selenium/regressions.t +++ b/t/db_dependent/selenium/regressions.t @@ -25,7 +25,7 @@ use Test::MockModule; use C4::Context; use C4::Biblio qw( AddBiblio ); use C4::Circulation; -use Koha::AuthUtils; +use Koha::AuthUtils qw(hash_password); use t::lib::Selenium; use t::lib::TestBuilder; use t::lib::Mocks; @@ -187,8 +187,11 @@ subtest 'XSS vulnerabilities in pagination' => sub { } my $password = Koha::AuthUtils::generate_password(); + my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare("UPDATE borrowers SET password = ? WHERE borrowernumber=?"); t::lib::Mocks::mock_preference( 'RequireStrongPassword', 0 ); - $patron->set_password({ password => $password }); + my $clave = hash_password( $password ); + $sth->execute( $clave, $patron->borrowernumber ); $s->opac_auth( $patron->userid, $password ); my $public_lists = $s->opac_base_url . q|opac-shelves.pl?op=list&category=2|; diff --git a/t/lib/Selenium.pm b/t/lib/Selenium.pm index 1a932a1abf..29f7ef4700 100644 --- a/t/lib/Selenium.pm +++ b/t/lib/Selenium.pm @@ -106,13 +106,12 @@ sub opac_auth { $login ||= $self->login; $password ||= $self->password; - my $mainpage = $self->base_url . 'opac-main.pl'; + my $mainpage = $self->opac_base_url . 'opac-main.pl'; $self->driver->get($mainpage . q|?logout.x=1|); # Logout before, to make sure we will see the login form $self->driver->get($mainpage); $self->fill_form( { userid => $login, password => $password } ); - my $login_button = $self->driver->find_element('//input[@id="submit"]'); - $login_button->submit(); + $self->submit_form; } sub fill_form { -- 2.11.0