]> BookStack Code Mirror - bookstack/commitdiff
Properly use env/config functions
authorbenrubson <redacted>
Sat, 23 May 2020 10:06:37 +0000 (12:06 +0200)
committerbenrubson <redacted>
Sat, 23 May 2020 10:06:37 +0000 (12:06 +0200)
app/Config/logging.php
app/Http/Controllers/Auth/LoginController.php

index 0b55dc24db921f55bb01460fe249560349736c4f..406b9f2f938892322aa74492d3a4bebc3ee021fc 100644 (file)
@@ -79,4 +79,9 @@ return [
         ],
     ],
 
+    // Failed Access Message
+    // Defines the message to log into webserver logs in case of failed access,
+    // for further processing by tools like Fail2Ban.
+    'failed_access_message' => env('FAILED_ACCESS_MESSAGE', ''),
+
 ];
index c000af49e13c9e6ce8e26b413bd7cf56a949f014..cf9e44e43421a0c0438ab2f2c1f4c7bc02f10cd1 100644 (file)
@@ -176,7 +176,7 @@ class LoginController extends Controller
       */
     protected function logFailedAccess($request)
     {
-        $log_msg = env('FAILED_ACCESS_MESSAGE', '');
+        $log_msg = config('logging.failed_access_message');
 
         if (!is_string($request->get($this->username())) || !is_string($log_msg) || strlen($log_msg)<1)
             return;