diff --git a/tests/index.php b/tests/index.php
index 691c0d1..105c07d 100644
--- a/tests/index.php
+++ b/tests/index.php
@@ -142,7 +142,20 @@ function processRequestData(\Delight\Auth\Auth $auth) {
}
else if ($_POST['action'] === 'confirmEmail') {
try {
- $auth->confirmEmail($_POST['selector'], $_POST['token']);
+ if (isset($_POST['login']) && $_POST['login'] > 0) {
+ if ($_POST['login'] == 2) {
+ // keep logged in for one year
+ $rememberDuration = (int) (60 * 60 * 24 * 365.25);
+ }
+ else {
+ // do not keep logged in after session ends
+ $rememberDuration = null;
+ }
+ $auth->confirmEmailAndSignIn($_POST['selector'], $_POST['token'], $rememberDuration);
+ }
+ else {
+ $auth->confirmEmail($_POST['selector'], $_POST['token']);
+ }
return 'ok';
}
@@ -557,6 +570,11 @@ function showGuestUserForm() {
echo '';
echo ' ';
echo ' ';
+ echo ' ';
echo '';
echo '';