From fb982cee6ad5bff6d7f6ab5520d7fad9e8974d4c Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 30 Jul 2017 14:20:31 +0200 Subject: [PATCH] Add tests for method 'confirmEmailAndSignIn' from class 'Auth' --- tests/index.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) 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 '';