File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed
Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -135,8 +135,11 @@ public static function isSecretAllowed(): bool
135135 $ maintenance_secret = rex_request ('maintenance_secret ' , 'string ' , '' );
136136 $ authentification_mode = (string ) self ::getConfig ('authentification_mode ' , '' );
137137
138- // Check if the correct secret is passed via URL or password
139- if (('URL ' === $ authentification_mode || 'password ' === $ authentification_mode ) && '' !== $ config_secret && $ maintenance_secret === $ config_secret ) {
138+ // Authentifizierung prüfen - für URL-Parameter und auch bei leerem Modus
139+ $ authentification_mode = (string ) self ::getConfig ('authentification_mode ' , '' );
140+ if (('' === $ authentification_mode || 'URL ' === $ authentification_mode || 'password ' === $ authentification_mode )
141+ && '' !== $ config_secret
142+ && $ maintenance_secret === $ config_secret ) {
140143 rex_set_session ('maintenance_secret ' , $ maintenance_secret );
141144 return true ;
142145 }
Original file line number Diff line number Diff line change 5050 $ addon ->removeConfig ('type ' );
5151 $ addon ->removeConfig ('secret ' );
5252}
53+
54+ // Leerer String ('') und 'URL' werden beide als gültige URL-Authentifizierung betrachtet
55+ $ authentification_mode = $ addon ->getConfig ('authentification_mode ' , '' );
56+ if (!in_array ($ authentification_mode , ['URL ' , 'password ' ], true )) {
57+ // Wenn kein gültiger Modus gesetzt ist, standardmäßig auf URL setzen
58+ $ addon ->setConfig ('authentification_mode ' , 'URL ' );
59+ }
60+
61+ // Überprüfen, ob ein maintenance_secret existiert
62+ if (!$ addon ->hasConfig ('maintenance_secret ' ) || '' === $ addon ->getConfig ('maintenance_secret ' )) {
63+ // Falls kein Secret vorhanden, ein neues generieren
64+ $ addon ->setConfig ('maintenance_secret ' , bin2hex (random_bytes (16 )));
65+ }
You can’t perform that action at this time.
0 commit comments