diff --git a/tests/index.php b/tests/index.php index 41a8b1c..171f692 100644 --- a/tests/index.php +++ b/tests/index.php @@ -614,6 +614,32 @@ function processRequestData(\Delight\Auth\Auth $auth) { return 'Username required'; } } + else if ($_POST['action'] === 'admin.changePasswordForUser') { + if (isset($_POST['newPassword'])) { + if (isset($_POST['username'])) { + try { + $auth->admin()->changePasswordForUserByUsername($_POST['username'], $_POST['newPassword']); + } + catch (\Delight\Auth\UnknownUsernameException $e) { + return 'unknown username'; + } + catch (\Delight\Auth\AmbiguousUsernameException $e) { + return 'ambiguous username'; + } + catch (\Delight\Auth\InvalidPasswordException $e) { + return 'invalid password'; + } + } + else { + return 'username required'; + } + } + else { + return 'new password required'; + } + + return 'ok'; + } else { throw new Exception('Unexpected action: ' . $_POST['action']); } @@ -944,6 +970,13 @@ function showGuestUserForm() { echo ' '; echo ''; echo ''; + + echo '
'; + echo ''; + echo ' '; + echo ' '; + echo ''; + echo '
'; } function showConfirmEmailForm() {