Fix twig variables: logged + account_logged being not set directly after login

This commit is contained in:
slawkens 2025-05-15 19:11:20 +02:00
parent 7c92d1c197
commit 1e9b10d648
2 changed files with 8 additions and 0 deletions

View File

@ -138,6 +138,9 @@ $ots = POT::getInstance();
$eloquentConnection = null; $eloquentConnection = null;
require_once SYSTEM . 'database.php'; require_once SYSTEM . 'database.php';
$twig->addGlobal('logged', false);
$twig->addGlobal('account_logged', new \OTS_Account());
// verify myaac tables exists in database // verify myaac tables exists in database
if(!defined('MYAAC_INSTALL') && !$db->hasTable('myaac_account_actions')) { if(!defined('MYAAC_INSTALL') && !$db->hasTable('myaac_account_actions')) {
throw new RuntimeException('Seems that the table myaac_account_actions of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting ' . (IS_CLI ? 'http://your-ip.com/' : BASE_URL) . 'install'); throw new RuntimeException('Seems that the table myaac_account_actions of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting ' . (IS_CLI ? 'http://your-ip.com/' : BASE_URL) . 'install');

View File

@ -95,3 +95,8 @@ else {
} }
$hooks->trigger(HOOK_ACCOUNT_LOGIN_POST); $hooks->trigger(HOOK_ACCOUNT_LOGIN_POST);
if($logged) {
$twig->addGlobal('logged', true);
$twig->addGlobal('account_logged', $account_logged);
}