diff --git a/tests/index.php b/tests/index.php index 4547d09..b21f641 100644 --- a/tests/index.php +++ b/tests/index.php @@ -246,6 +246,37 @@ function processRequestData(\Delight\Auth\Auth $auth) { return 'invalid password(s)'; } } + else if ($_POST['action'] === 'changeEmail') { + try { + $auth->changeEmail($_POST['newEmail'], function ($selector, $token) { + echo '
';
+						echo 'Email confirmation';
+						echo "\n";
+						echo '  >  Selector';
+						echo "\t\t\t\t";
+						echo htmlspecialchars($selector);
+						echo "\n";
+						echo '  >  Token';
+						echo "\t\t\t\t";
+						echo htmlspecialchars($token);
+						echo '
'; + }); + + return 'ok'; + } + catch (\Delight\Auth\InvalidEmailException $e) { + return 'invalid email address'; + } + catch (\Delight\Auth\UserAlreadyExistsException $e) { + return 'email address already exists'; + } + catch (\Delight\Auth\EmailNotVerifiedException $e) { + return 'account not verified'; + } + catch (\Delight\Auth\NotLoggedInException $e) { + return 'not logged in'; + } + } else if ($_POST['action'] === 'setPasswordResetEnabled') { try { $auth->setPasswordResetEnabled($_POST['enabled'] == 1); @@ -536,6 +567,12 @@ function showAuthenticatedUserForm(\Delight\Auth\Auth $auth) { echo ''; echo ''; + echo '
'; + echo ''; + echo ' '; + echo ''; + echo '
'; + showConfirmEmailForm(); echo '
';