Skip to content

Commit

Permalink
GH-150 Create cookie clearing utility
Browse files Browse the repository at this point in the history
  • Loading branch information
mdziekon committed Feb 9, 2021
1 parent 81c7a6c commit 5eff7d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 1 addition & 3 deletions modules/session/input/cookieLogin.inputHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,8 @@ function handleCookieLogin($params) {
]);

if (!$verificationResult['isSuccess']) {
$sessionCookieKey = getSessionCookieKey();

// TODO: Side effect, move elsewhere (?)
setcookie($sessionCookieKey, false, 0, '/', '');
Session\Utils\Cookie\clearSessionCookie();

return $createFailure([
'code' => $verificationResult['error']['code'],
Expand Down
6 changes: 6 additions & 0 deletions modules/session/utils/cookie.utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ function getSessionCookieValue() {
return $_COOKIE[$cookieName];
}

function clearSessionCookie() {
$cookieName = getSessionCookieKey();

setcookie($cookieName, false, 0, '/', '');
}

function getServerSecretWord() {
global $_EnginePath, $__ServerConnectionSettings;

Expand Down

0 comments on commit 5eff7d6

Please sign in to comment.