Release Bludit Secure 0.1.5

This commit is contained in:
interlope committed 2026-11-02 20:50:15 +01:00
1 parent 49b4308028
commit 0b983bcfbb
10 files changed
+320 -154

No files matched your search

+36 -5
View File
@@ -2,15 +2,17 @@
class pluginBluditSecure extends Plugin
{
private ?int $loginBufferLevel = null;
public function init() {
$this->dbFields = ['ssoLabel'=>'Pocket ID', 'issuer'=>'', 'clientId'=>'', 'clientSecret'=>''];
}
public function form() {
$html = '<p>Chaque utilisateur gère ses facteurs dans <a href="'.HTML_PATH_ADMIN_ROOT.'login?bs=account">Sécurité de mon compte</a>.</p>';
foreach (['ssoLabel'=>'Nom du SSO (Se connecter avec …)', 'issuer'=>'URL HTTPS de Pocket ID / issuer OIDC', 'clientId'=>'Client ID', 'clientSecret'=>'Client secret'] as $key=>$label) {
$html = '<p>Each user can manage their authentication methods in <a href="'.HTML_PATH_ADMIN_ROOT.'plugin/pluginbluditsecure">Security</a>.</p>';
foreach (['ssoLabel'=>'SSO name (Sign in with …)', 'issuer'=>'OIDC issuer URL (HTTPS)', 'clientId'=>'Client ID', 'clientSecret'=>'Client secret'] as $key=>$label) {
$html .= '<div><label>'.htmlspecialchars($label).'</label><input name="'.$key.'" type="'.($key==='clientSecret'?'password':'text').'" value="'.($key==='clientSecret'?'':htmlspecialchars($this->getValue($key, false), ENT_QUOTES, 'UTF-8')).'" autocomplete="off"></div>';
}
return $html.'<p>Secret vide : conserver le secret existant. URI de retour OIDC : <code>'.htmlspecialchars(DOMAIN_ADMIN.'login?bs=oidc').'</code>. Aucun compte n’est associé automatiquement par e-mail : chaque utilisateur lie son identité depuis son espace personnel.</p>';
return $html.'<p>Leave the secret blank to keep the existing value. OIDC redirect URI: <code>'.htmlspecialchars(DOMAIN_ADMIN.'login?bs=oidc').'</code>. Accounts are never linked automatically by email. Each user must link their SSO identity from Security.</p>';
}
public function post() {
if (empty($_POST['clientSecret'])) { unset($_POST['clientSecret']); }
@@ -32,10 +34,39 @@ class pluginBluditSecure extends Plugin
error_log('bludit-secure: '.get_class($e).' '.$e->getMessage());
http_response_code(503);
header('Cache-Control: no-store');
exit('Bludit Secure indisponible. Consulter les journaux du serveur.');
exit('Bludit Secure is unavailable. Check the server logs.');
}
}
public function beforeAdminLoad() {
global $login, $layout;
if (!$login->isLogged()) {
// Password POSTs are checked in prepare(); never execute native remember-me login.
$layout['controller'] = 'bludit-secure-login';
$layout['plugin'] = false;
}
}
public function loginBodyBegin() {
$this->loginBufferLevel = ob_get_level();
ob_start();
}
public function loginBodyEnd() {
if ($this->loginBufferLevel === null || ob_get_level() !== $this->loginBufferLevel + 1) {
return '';
}
$html = ob_get_clean();
$this->loginBufferLevel = null;
return (new \BluditSecure\App($this))->renderLogin($html);
}
public function adminController() {
global $layout;
$layout['title'] = 'Security';
header('Cache-Control: no-store');
header('Referrer-Policy: no-referrer');
}
public function adminView() {
return (new \BluditSecure\App($this))->accountView();
}
public function adminSidebar() {
return '<a class="nav-link" href="'.HTML_PATH_ADMIN_ROOT.'login?bs=account">Sécurité de mon compte</a>';
return '<a class="nav-link" href="'.HTML_PATH_ADMIN_ROOT.'plugin/pluginbluditsecure"><span class="fa fa-shield" aria-hidden="true"></span>Security</a>';
}
}