diff --git a/composer.json b/composer.json index fb7e942..ce2dd9e 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "dashboard/unifi", "description": "UniFi network management, WiFi stats, and captive portal authentication for the Dashboard platform", - "version": "1.13.3", + "version": "1.13.4", "type": "library", "license": "MIT", "autoload": { diff --git a/src/Http/Controllers/PortalController.php b/src/Http/Controllers/PortalController.php index c970038..3501c13 100644 --- a/src/Http/Controllers/PortalController.php +++ b/src/Http/Controllers/PortalController.php @@ -36,7 +36,11 @@ class PortalController extends Controller 'match_value' => 'required|string|max:255', 'vlan_id' => 'required|integer|min:1|max:4094', 'max_devices' => 'required|integer|min:1|max:50', - 'session_minutes' => 'required|integer|min:1', + // Bounded by the column that stores it: unifi_vlan_mappings.session_minutes + // is unsignedInteger, so an unbounded value reached the INSERT and raised + // SQLSTATE 22003 — a 500 where a validation error belongs (central-unifi#5). + // 525600 minutes is a year, far more session than anyone will ever grant. + 'session_minutes' => 'required|integer|min:1|max:525600', ]); $data['sort_order'] = VlanMapping::max('sort_order') + 1; VlanMapping::create($data); @@ -51,7 +55,11 @@ class PortalController extends Controller 'match_value' => 'required|string|max:255', 'vlan_id' => 'required|integer|min:1|max:4094', 'max_devices' => 'required|integer|min:1|max:50', - 'session_minutes' => 'required|integer|min:1', + // Bounded by the column that stores it: unifi_vlan_mappings.session_minutes + // is unsignedInteger, so an unbounded value reached the INSERT and raised + // SQLSTATE 22003 — a 500 where a validation error belongs (central-unifi#5). + // 525600 minutes is a year, far more session than anyone will ever grant. + 'session_minutes' => 'required|integer|min:1|max:525600', ]); $mapping->update($data); return back()->with('success', 'Mapping updated.');