Skip to content
Merged
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
7 changes: 5 additions & 2 deletions lib/Maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ public static function isSecretAllowed(): bool
$maintenance_secret = rex_request('maintenance_secret', 'string', '');
$authentification_mode = (string) self::getConfig('authentification_mode', '');

// Check if the correct secret is passed via URL or password
if (('URL' === $authentification_mode || 'password' === $authentification_mode) && '' !== $config_secret && $maintenance_secret === $config_secret) {
// Authentifizierung prüfen - für URL-Parameter und auch bei leerem Modus
$authentification_mode = (string) self::getConfig('authentification_mode', '');
if (('' === $authentification_mode || 'URL' === $authentification_mode || 'password' === $authentification_mode)
&& '' !== $config_secret
&& $maintenance_secret === $config_secret) {
rex_set_session('maintenance_secret', $maintenance_secret);
return true;
}
Expand Down
13 changes: 13 additions & 0 deletions update.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,16 @@
$addon->removeConfig('type');
$addon->removeConfig('secret');
}

// Leerer String ('') und 'URL' werden beide als gültige URL-Authentifizierung betrachtet
$authentification_mode = $addon->getConfig('authentification_mode', '');
if (!in_array($authentification_mode, ['URL', 'password'], true)) {
// Wenn kein gültiger Modus gesetzt ist, standardmäßig auf URL setzen
$addon->setConfig('authentification_mode', 'URL');
}

// Überprüfen, ob ein maintenance_secret existiert
if (!$addon->hasConfig('maintenance_secret') || '' === $addon->getConfig('maintenance_secret')) {
// Falls kein Secret vorhanden, ein neues generieren
$addon->setConfig('maintenance_secret', bin2hex(random_bytes(16)));
}