Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Sources/Actions/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ public function execute(): void
'name' => Lang::getTxt('login', file: 'General'),
];

// Ensure the session data persists.
if (empty($_COOKIE)) {
Cookie::setLoginCookie(Cookie::LENGTH_DEFAULT, 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']) && !str_contains($_SESSION['old_url'], 'dlattach') && preg_match('~(board|topic)[=,]~', $_SESSION['old_url']) != 0) {
$_SESSION['login_url'] = $_SESSION['old_url'];
Expand Down
1 change: 1 addition & 0 deletions Sources/Actions/Login2.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public function main(): void

// Cookies are required...
if (empty($_COOKIE)) {
Cookie::setLoginCookie(Cookie::LENGTH_DEFAULT, 0, '');
Utils::$context['login_errors'] = [Lang::getTxt('login_cookie_error', file: 'Errors')];

return;
Expand Down
4 changes: 4 additions & 0 deletions Sources/Forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,10 @@ protected function requireAgreement(): void
protected static function inMaintenance(): void
{
Theme::loadTemplate('Login');

if (empty($_COOKIE)) {
Cookie::setLoginCookie(Cookie::LENGTH_DEFAULT, 0, '');
}
SecurityToken::create('login');

// Send a 503 header, so search engines don't bother indexing while we're in maintenance mode.
Expand Down
4 changes: 4 additions & 0 deletions Sources/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -1578,6 +1578,10 @@ public function kickIfGuest(?string $message = null, bool $log = true): void
// Load the Login template and language file.
Theme::loadTemplate('Login');

if (empty($_COOKIE)) {
Cookie::setLoginCookie(Cookie::LENGTH_DEFAULT, 0, '');
}

// Create a login token.
SecurityToken::create('login');

Expand Down
Loading