1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-07-31 13:20:11 +02:00

Add tests for method 'logOutEverywhere' from class 'Auth'

This commit is contained in:
Marco
2018-03-25 00:31:02 +01:00
parent 3ae1769256
commit 79c5a4f6d5

View File

@@ -383,6 +383,16 @@ function processRequestData(\Delight\Auth\Auth $auth) {
return 'ok';
}
else if ($_POST['action'] === 'logOutEverywhere') {
try {
$auth->logOutEverywhere();
}
catch (\Delight\Auth\NotLoggedInException $e) {
return 'not logged in';
}
return 'ok';
}
else if ($_POST['action'] === 'logOutAndDestroySession') {
$auth->logOutAndDestroySession();
@@ -807,6 +817,11 @@ function showAuthenticatedUserForm(\Delight\Auth\Auth $auth) {
echo '<button type="submit">Log out</button>';
echo '</form>';
echo '<form action="" method="post" accept-charset="utf-8">';
echo '<input type="hidden" name="action" value="logOutEverywhere" />';
echo '<button type="submit">Log out everywhere</button>';
echo '</form>';
echo '<form action="" method="post" accept-charset="utf-8">';
echo '<input type="hidden" name="action" value="logOutAndDestroySession" />';
echo '<button type="submit">Log out and destroy session</button>';