diff --git a/tests/index.php b/tests/index.php index 48690b3..83717ff 100644 --- a/tests/index.php +++ b/tests/index.php @@ -107,6 +107,22 @@ function processRequestData(\Delight\Auth\Auth $auth) { return 'too many requests'; } } + else if ($_POST['action'] === 'provideOneTimePasswordAsSecondFactor') { + try { + $auth->provideOneTimePasswordAsSecondFactor($_POST['otpValue']); + + return 'ok'; + } + catch (\Delight\Auth\InvalidOneTimePasswordException $e) { + return 'invalid OTP'; + } + catch (\Delight\Auth\NotLoggedInException $e) { + return 'first factor not completed'; + } + catch (\Delight\Auth\TooManyRequestsException $e) { + return 'too many requests'; + } + } else if ($_POST['action'] === 'register') { try { if ($_POST['require_verification'] == 1) { @@ -978,6 +994,12 @@ function showGuestUserForm() { echo ''; echo ''; + echo '
'; + echo ''; + echo ' '; + echo ''; + echo '
'; + echo '
'; echo ''; echo ' ';