diff --git a/tests/index.php b/tests/index.php
index 1599f78..f7dae0d 100644
--- a/tests/index.php
+++ b/tests/index.php
@@ -86,7 +86,16 @@ function processRequestData(\Delight\Auth\Auth $auth) {
$callback = null;
}
- return $auth->register($_POST['email'], $_POST['password'], $_POST['username'], $callback);
+ if (!isset($_POST['require_unique_username'])) {
+ $_POST['require_unique_username'] = '0';
+ }
+
+ if ($_POST['require_unique_username'] == 0) {
+ return $auth->register($_POST['email'], $_POST['password'], $_POST['username'], $callback);
+ }
+ else {
+ return $auth->registerWithUniqueUsername($_POST['email'], $_POST['password'], $_POST['username'], $callback);
+ }
}
catch (\Delight\Auth\InvalidEmailException $e) {
return 'invalid email address';
@@ -95,7 +104,10 @@ function processRequestData(\Delight\Auth\Auth $auth) {
return 'invalid password';
}
catch (\Delight\Auth\UserAlreadyExistsException $e) {
- return 'user already exists';
+ return 'email address already exists';
+ }
+ catch (\Delight\Auth\DuplicateUsernameException $e) {
+ return 'username already exists';
}
catch (\Delight\Auth\TooManyRequestsException $e) {
return 'too many requests';
@@ -275,6 +287,10 @@ function showGuestUserForm() {
echo '';
echo '';
echo ' ';
+ echo ' ';
echo '';
echo '';