From 2cace3c73a6e9b27dcad0e715c3feffc745d44c4 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 30 Jun 2022 15:08:12 -0700 Subject: [PATCH 1/3] Added LDAP warnings on page load Signed-off-by: snipe --- app/Http/Controllers/SettingsController.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 7fd7ea4f1..ab2add1e8 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -25,6 +25,7 @@ use Response; use App\Http\Requests\SlackSettingsRequest; use Illuminate\Support\Str; use Illuminate\Support\Facades\Artisan; +use Validator; /** * This controller handles all actions related to Settings for @@ -910,7 +911,22 @@ class SettingsController extends Controller { $setting = Setting::getSettings(); - return view('settings.ldap', compact('setting')); + /** + * This validator is only temporary (famous last words.) - @snipe + */ + $messages = [ + 'ldap_username_field.not_in' => 'sAMAccountName (mixed case) will likely not work. You should use samaccountName (lowercase) instead. ', + 'ldap_auth_filter_query.not_in' => 'uid=samaccountname is probably not a valud auth filter. You probably want uid= ', + ]; + + $validator = Validator::make($setting->toArray(), [ + 'ldap_username_field' => 'not_in:sAMAccountName', + 'ldap_auth_filter_query' => 'not_in:uid=samaccountname', + ], $messages); + + + + return view('settings.ldap', compact('setting'))->withErrors($validator); } /** From 7591f3f092a49b63a71c350114831b76fb2f4fcd Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 30 Jun 2022 15:15:49 -0700 Subject: [PATCH 2/3] Added auth filter check regex Signed-off-by: snipe --- app/Http/Controllers/SettingsController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index ab2add1e8..8ac0b3622 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -917,11 +917,13 @@ class SettingsController extends Controller $messages = [ 'ldap_username_field.not_in' => 'sAMAccountName (mixed case) will likely not work. You should use samaccountName (lowercase) instead. ', 'ldap_auth_filter_query.not_in' => 'uid=samaccountname is probably not a valud auth filter. You probably want uid= ', + 'ldap_filter.regex' => 'This value should probably not be wrapped in parentheses.', ]; $validator = Validator::make($setting->toArray(), [ 'ldap_username_field' => 'not_in:sAMAccountName', 'ldap_auth_filter_query' => 'not_in:uid=samaccountname', + 'ldap_filter' => 'regex:"^[^(]"', ], $messages); From 1a423a252bf2520d34f08c39bfff05a1910c5a61 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 30 Jun 2022 15:22:58 -0700 Subject: [PATCH 3/3] Derp Signed-off-by: snipe --- app/Http/Controllers/SettingsController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 8ac0b3622..29ef2234e 100755 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -915,7 +915,7 @@ class SettingsController extends Controller * This validator is only temporary (famous last words.) - @snipe */ $messages = [ - 'ldap_username_field.not_in' => 'sAMAccountName (mixed case) will likely not work. You should use samaccountName (lowercase) instead. ', + 'ldap_username_field.not_in' => 'sAMAccountName (mixed case) will likely not work. You should use samaccountname (lowercase) instead. ', 'ldap_auth_filter_query.not_in' => 'uid=samaccountname is probably not a valud auth filter. You probably want uid= ', 'ldap_filter.regex' => 'This value should probably not be wrapped in parentheses.', ];