diff --git a/tests/index.php b/tests/index.php index f7dae0d..6aef647 100644 --- a/tests/index.php +++ b/tests/index.php @@ -48,13 +48,27 @@ function processRequestData(\Delight\Auth\Auth $auth) { } try { - $auth->login($_POST['email'], $_POST['password'], $rememberDuration); + if (isset($_POST['email'])) { + $auth->login($_POST['email'], $_POST['password'], $rememberDuration); + } + elseif (isset($_POST['username'])) { + $auth->loginWithUsername($_POST['username'], $_POST['password'], $rememberDuration); + } + else { + return 'either email address or username required'; + } return 'ok'; } catch (\Delight\Auth\InvalidEmailException $e) { return 'wrong email address'; } + catch (\Delight\Auth\UnknownUsernameException $e) { + return 'unknown username'; + } + catch (\Delight\Auth\AmbiguousUsernameException $e) { + return 'ambiguous username'; + } catch (\Delight\Auth\InvalidPasswordException $e) { return 'wrong password'; } @@ -275,7 +289,18 @@ function showGuestUserForm() { echo ''; echo ''; echo ' '; - echo ''; + echo ''; + echo ''; + + echo '
'; + echo ''; + echo ' '; + echo ' '; + echo ' '; + echo ''; echo '
'; echo '
';