From 1657102f75a3b2c346a1c600234d44d3413c1c53 Mon Sep 17 00:00:00 2001 From: Marco Date: Sat, 10 Mar 2018 04:06:45 +0100 Subject: [PATCH] Add tests for method 'canResetPasswordOrThrow' from class 'Auth' --- tests/index.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tests/index.php b/tests/index.php index 89f9f06..e7e929f 100644 --- a/tests/index.php +++ b/tests/index.php @@ -273,6 +273,25 @@ function processRequestData(\Delight\Auth\Auth $auth) { return 'too many requests'; } } + else if ($_POST['action'] === 'canResetPassword') { + try { + $auth->canResetPasswordOrThrow($_POST['selector'], $_POST['token']); + + return 'yes'; + } + catch (\Delight\Auth\InvalidSelectorTokenPairException $e) { + return 'invalid token'; + } + catch (\Delight\Auth\TokenExpiredException $e) { + return 'token expired'; + } + catch (\Delight\Auth\ResetDisabledException $e) { + return 'password reset is disabled'; + } + catch (\Delight\Auth\TooManyRequestsException $e) { + return 'too many requests'; + } + } else if ($_POST['action'] === 'reconfirmPassword') { try { return $auth->reconfirmPassword($_POST['password']) ? 'correct' : 'wrong'; @@ -812,6 +831,13 @@ function showGuestUserForm() { echo ''; echo ''; + echo '
'; + echo ''; + echo ' '; + echo ' '; + echo ''; + echo '
'; + echo '

Administration

'; echo '
';