Skip to content
6 changes: 6 additions & 0 deletions Sources/LogInOut.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ function Login()
'name' => $txt['login'],
);

// Ensure the session data persists.
if (empty($_COOKIE)) {
setLoginCookie(60 * $modSettings['cookieTime'], 0, '');
}

// Set the login URL - will be used when the login process is done (but careful not to send us to an attachment).
if (isset($_SESSION['old_url']) && strpos($_SESSION['old_url'], 'dlattach') === false && preg_match('~(board|topic)[=,]~', $_SESSION['old_url']) != 0)
$_SESSION['login_url'] = $_SESSION['old_url'];
Expand Down Expand Up @@ -263,6 +268,7 @@ function Login2()
// Cookies are required...
if (empty($_COOKIE))
{
setLoginCookie(60 * $modSettings['cookieTime'], 0, '');
$context['login_errors'] = array($txt['login_cookie_error']);
return;
}
Expand Down
10 changes: 8 additions & 2 deletions Sources/Subs-Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,14 @@ function url_parts($local, $global)
*/
function KickGuest()
{
global $txt, $context;
global $txt, $context, $modSettings;

loadTheme();
loadLanguage('Login');
loadTemplate('Login');
if (empty($_COOKIE)) {
setLoginCookie(60 * $modSettings['cookieTime'], 0, '');
}
createToken('login');

// Never redirect to an attachment
Expand All @@ -232,10 +235,13 @@ function KickGuest()
*/
function InMaintenance()
{
global $txt, $mtitle, $mmessage, $context, $smcFunc;
global $txt, $mtitle, $mmessage, $context, $smcFunc, $modSettings;

loadLanguage('Login');
loadTemplate('Login');
if (empty($_COOKIE)) {
setLoginCookie(60 * $modSettings['cookieTime'], 0, '');
}
createToken('login');

// Send a 503 header, so search engines don't bother indexing while we're in maintenance mode.
Expand Down
Loading