2ca1da4f8e
Roundcube autologin fix: - Added missing session->regenerate_id(false) and session->set_auth_cookie() calls after login, matching Roundcube's normal login flow in index.php. Without these, the roundcube_sessauth cookie was never set, causing every second request to fail with 'session is invalid or expired'. Hamburger menu fix: - Added activateWindow() + raise_() + processEvents() before menu.exec_() to ensure the toolbar window is active before the QMenu event loop starts. Without this, WA_ShowWithoutActivating prevents focus from being grabbed and the menu vanishes immediately. - Added try/except to surface any silent errors.
45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* Kiosk Auto-Login Plugin
|
|
* Automatically logs in — senior user never sees the login screen.
|
|
* Mirrors the exact session setup from index.php's normal login flow:
|
|
* login() -> session->remove('temp') -> session->regenerate_id(false)
|
|
* -> session->set_auth_cookie() -> redirect
|
|
*/
|
|
class autologin extends rcube_plugin
|
|
{
|
|
public $task = 'login';
|
|
|
|
function init()
|
|
{
|
|
$this->add_hook('startup', array($this, 'startup'));
|
|
}
|
|
|
|
function startup($args)
|
|
{
|
|
$rcmail = rcmail::get_instance();
|
|
|
|
if ($args['task'] == 'login' && empty($_SESSION['user_id'])) {
|
|
$username = 'rudbelik@gmail.com';
|
|
$password = 'zrhencfwzvgbqqfs';
|
|
$host = 'ssl://imap.gmail.com:993';
|
|
|
|
$loggedin = $rcmail->login($username, $password, $host, false);
|
|
|
|
rcube::write_log('autologin', 'Login attempt ��� result: ' . ($loggedin ? 'SUCCESS' : 'FAILED'));
|
|
|
|
if ($loggedin) {
|
|
// Replicate exact post-login session setup from index.php
|
|
$rcmail->session->remove('temp');
|
|
$rcmail->session->regenerate_id(false);
|
|
$rcmail->session->set_auth_cookie();
|
|
|
|
header('Location: ' . $rcmail->url(array('_task' => 'mail')));
|
|
exit;
|
|
}
|
|
}
|
|
|
|
return $args;
|
|
}
|
|
}
|