0
0
Fork 0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-05-20 06:59:38 +00:00

Users API: Fixed sending invite when using form requests

- Cast send_invite value in cases where it might not have been a boolean,
  which occurs on non-JSON requests.
- Added test to cover.
- Updated API docs to mention and shown boolean usage.
This commit is contained in:
Dan Brown 2023-12-13 15:11:42 +00:00
parent 4896c4047f
commit 56d07f1909
No known key found for this signature in database
GPG key ID: 46D9F943C24A2EF9
3 changed files with 27 additions and 2 deletions
app/Users/Controllers

View file

@ -90,7 +90,7 @@ class UserApiController extends ApiController
public function create(Request $request)
{
$data = $this->validate($request, $this->rules()['create']);
$sendInvite = ($data['send_invite'] ?? false) === true;
$sendInvite = boolval($data['send_invite'] ?? false) === true;
$user = null;
DB::transaction(function () use ($data, $sendInvite, &$user) {