mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-08-04 07:07:25 +02:00
Add tests for method 'logOutEverywhere' from class 'Auth'
This commit is contained in:
@@ -383,6 +383,16 @@ function processRequestData(\Delight\Auth\Auth $auth) {
|
|||||||
|
|
||||||
return 'ok';
|
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') {
|
else if ($_POST['action'] === 'logOutAndDestroySession') {
|
||||||
$auth->logOutAndDestroySession();
|
$auth->logOutAndDestroySession();
|
||||||
|
|
||||||
@@ -807,6 +817,11 @@ function showAuthenticatedUserForm(\Delight\Auth\Auth $auth) {
|
|||||||
echo '<button type="submit">Log out</button>';
|
echo '<button type="submit">Log out</button>';
|
||||||
echo '</form>';
|
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 '<form action="" method="post" accept-charset="utf-8">';
|
||||||
echo '<input type="hidden" name="action" value="logOutAndDestroySession" />';
|
echo '<input type="hidden" name="action" value="logOutAndDestroySession" />';
|
||||||
echo '<button type="submit">Log out and destroy session</button>';
|
echo '<button type="submit">Log out and destroy session</button>';
|
||||||
|
Reference in New Issue
Block a user