diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index c42dfd0975..b34f4d886c 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -114,7 +114,7 @@ class SettingsController extends Controller $setting->email_domain = $request->input('email_domain'); $setting->email_format = $request->input('email_format'); $setting->username_format = $request->input('username_format'); - $setting->require_accept_signature = $request->input('require_accept_signature'); + $setting->require_accept_signature = $request->input('require_accept_signature', '0'); $setting->show_assigned_assets = $request->input('show_assigned_assets', '0'); if (! config('app.lock_passwords')) { $setting->login_note = $request->input('login_note'); diff --git a/app/Models/Traits/Loggable.php b/app/Models/Traits/Loggable.php index d38ac4066f..84a24d80bf 100644 --- a/app/Models/Traits/Loggable.php +++ b/app/Models/Traits/Loggable.php @@ -10,7 +10,10 @@ use App\Models\Location; use App\Models\Setting; use App\Models\User; use App\Notifications\AuditNotification; +use GuzzleHttp\Exception\ClientException; use GuzzleHttp\Exception\ConnectException; +use GuzzleHttp\Exception\RequestException; +use GuzzleHttp\Exception\ServerException; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; @@ -287,7 +290,7 @@ trait Loggable if(Setting::getSettings()->webhook_selected === 'microsoft' && Str::contains(Setting::getSettings()->webhook_endpoint, 'workflows')) { - $endpoint = Setting::getSettings()->webhook_endpoint; + $endpoint = Setting::getSettings()->webhook_endpoint; try { $message = AuditNotification::toMicrosoftTeams($params); @@ -297,10 +300,31 @@ trait Loggable } catch (ConnectException $e) { Log::warning('Teams webhook connection failed', [ 'endpoint' => $endpoint, + 'error' => $e->getMessage() + ]); + + } catch (ServerException $e) { + + Log::error('Teams webhook server error', [ + 'endpoint' => $endpoint, + 'status' => $e->getResponse()?->getStatusCode(), 'error' => $e->getMessage(), ]); - } catch (Throwable $e) { + } catch (ClientException $e) { + + Log::warning('Teams webhook client error', [ + 'endpoint' => $endpoint, + 'status' => $e->getResponse()?->getStatusCode(), + 'error' => $e->getMessage(), + ]); + } catch (RequestException $e) { + + Log::error('Teams webhook request failure', [ + 'endpoint' => $endpoint, + 'error' => $e->getMessage(), + ]); + }catch (Throwable $e) { Log::error('Teams webhook failed unexpectedly', [ 'endpoint' => $endpoint, 'exception' => get_class($e),