X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/a274406038e13cf678e14d65dfa70d04ead67206..e4e130a5da5bdd2ef75a2fbcf4e7278d472d3872:/tests/Auth/MfaVerificationTest.php diff --git a/tests/Auth/MfaVerificationTest.php b/tests/Auth/MfaVerificationTest.php index ee6f3ecc8..7286a1de8 100644 --- a/tests/Auth/MfaVerificationTest.php +++ b/tests/Auth/MfaVerificationTest.php @@ -23,7 +23,7 @@ class MfaVerificationTest extends TestCase $resp = $this->get('/mfa/verify'); $resp->assertSee('Verify Access'); $resp->assertSee('Enter the code, generated using your mobile app, below:'); - $resp->assertElementExists('form[action$="/mfa/totp/verify"] input[name="code"]'); + $resp->assertElementExists('form[action$="/mfa/totp/verify"] input[name="code"][autofocus]'); $google2fa = new Google2FA(); $resp = $this->post('/mfa/totp/verify', [ @@ -241,8 +241,18 @@ class MfaVerificationTest extends TestCase } } + public function test_login_mfa_interception_does_not_log_error() + { + $logHandler = $this->withTestLogger(); + + [$user, $secret, $loginResp] = $this->startTotpLogin(); + + $loginResp->assertRedirect('/mfa/verify'); + $this->assertFalse($logHandler->hasErrorRecords()); + } + /** - * @return Array + * @return array */ protected function startTotpLogin(): array { @@ -260,7 +270,7 @@ class MfaVerificationTest extends TestCase } /** - * @return Array + * @return array */ protected function startBackupCodeLogin($codes = ['kzzu6-1pgll', 'bzxnf-plygd', 'bwdsp-ysl51', '1vo93-ioy7n', 'lf7nw-wdyka', 'xmtrd-oplac']): array {