diff --git a/app/Auth/UserRepo.php b/app/Auth/UserRepo.php index c87fda4c8..f9cfc078e 100644 --- a/app/Auth/UserRepo.php +++ b/app/Auth/UserRepo.php @@ -192,7 +192,7 @@ class UserRepo */ public function create(array $data, bool $sendInvite = false): User { - $user = $this->createWithoutActivity($data, false); + $user = $this->createWithoutActivity($data, true); if ($sendInvite) { $this->inviteService->sendInvitation($user); diff --git a/app/Exceptions/NotifyException.php b/app/Exceptions/NotifyException.php index e09247208..ced478090 100644 --- a/app/Exceptions/NotifyException.php +++ b/app/Exceptions/NotifyException.php @@ -39,6 +39,11 @@ class NotifyException extends Exception implements Responsable { $message = $this->getMessage(); + // Front-end JSON handling. API-side handling managed via handler. + if ($request->wantsJson()) { + return response()->json(['error' => $message], 403); + } + if (!empty($message)) { session()->flash('error', $message); } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 46e858d9b..3b443aa81 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -140,6 +140,7 @@ class UserController extends Controller 'language' => ['string'], 'roles' => ['array'], 'roles.*' => ['integer'], + 'external_auth_id' => ['string'], 'profile_image' => array_merge(['nullable'], $this->getImageValidationRules()), ]); diff --git a/tests/Auth/UserInviteTest.php b/tests/Auth/UserInviteTest.php index 922a98ef3..38124cc1a 100644 --- a/tests/Auth/UserInviteTest.php +++ b/tests/Auth/UserInviteTest.php @@ -45,9 +45,7 @@ class UserInviteTest extends TestCase 'name' => 'Barry', 'email' => $email, 'send_invite' => 'true', - 'setting' => [ - 'language' => 'de', - ], + 'language' => 'de', ]); $resp->assertRedirect('/settings/users'); diff --git a/tests/User/UserManagementTest.php b/tests/User/UserManagementTest.php index 2fbbee7e2..5870b6827 100644 --- a/tests/User/UserManagementTest.php +++ b/tests/User/UserManagementTest.php @@ -189,7 +189,7 @@ class UserManagementTest extends TestCase foreach ($langs as $lang) { config()->set('app.locale', $lang); $resp = $this->asAdmin()->get('/settings/users/create'); - $resp->assertElementExists('select[name="setting[language]"] option[value="' . $lang . '"][selected]'); + $resp->assertElementExists('select[name="language"] option[value="' . $lang . '"][selected]'); } }