Lines 16-22
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 Test::More tests => 2; |
19 |
use Test::More tests => 3; |
20 |
|
20 |
|
21 |
use C4::Context; |
21 |
use C4::Context; |
22 |
use Koha::AuthUtils; |
22 |
use Koha::AuthUtils; |
Lines 148-153
SKIP: {
Link Here
|
148 |
} |
148 |
} |
149 |
}; |
149 |
}; |
150 |
|
150 |
|
|
|
151 |
subtest "Disable" => sub { |
152 |
plan tests => 4; |
153 |
|
154 |
my $mainpage = $s->base_url . q|mainpage.pl|; |
155 |
$driver->get( $mainpage . q|?logout.x=1| ); |
156 |
fill_login_form($s); |
157 |
my $auth = Koha::Auth::TwoFactorAuth->new( { patron => $patron } ); |
158 |
my $code = $auth->code(); |
159 |
$auth->clear; |
160 |
$driver->find_element('//form[@id="loginform"]//input[@id="otp_token"]') |
161 |
->send_keys($code); |
162 |
$driver->find_element('//input[@type="submit"]')->click; |
163 |
|
164 |
$driver->get( $s->base_url . q|members/two_factor_auth.pl| ); |
165 |
|
166 |
is( |
167 |
$driver->find_element('//div[@class="two-factor-status"]')->get_text(), |
168 |
'Status: Enabled', |
169 |
'2FA is enabled' |
170 |
); |
171 |
|
172 |
$driver->find_element('//form[@id="two-factor-auth"]//input[@type="submit"]')->click; |
173 |
|
174 |
is( |
175 |
$driver->find_element('//div[@class="two-factor-status"]')->get_text(), |
176 |
'Status: Disabled', |
177 |
'2FA has been disabled' |
178 |
); |
179 |
|
180 |
$patron = $patron->get_from_storage; |
181 |
is( $patron->secret, undef, "Secret has been cleared" ); |
182 |
is( $patron->auth_method(), 'password', 'auth_method has been reset to "password"' ); |
183 |
}; |
184 |
|
151 |
$driver->quit(); |
185 |
$driver->quit(); |
152 |
}; |
186 |
}; |
153 |
|
187 |
|
154 |
- |
|
|