diff --git a/app/Http/Controllers/Api/Client/AccountController.php b/app/Http/Controllers/Api/Client/AccountController.php index 84b789c95..004490e96 100644 --- a/app/Http/Controllers/Api/Client/AccountController.php +++ b/app/Http/Controllers/Api/Client/AccountController.php @@ -4,7 +4,7 @@ namespace Pterodactyl\Http\Controllers\Api\Client; use Illuminate\Http\Request; use Illuminate\Http\Response; -use Illuminate\Auth\SessionGuard; +use Illuminate\Auth\AuthManager; use Pterodactyl\Services\Users\UserUpdateService; use Pterodactyl\Transformers\Api\Client\AccountTransformer; use Pterodactyl\Http\Requests\Api\Client\Account\UpdateEmailRequest; @@ -12,24 +12,26 @@ use Pterodactyl\Http\Requests\Api\Client\Account\UpdatePasswordRequest; class AccountController extends ClientApiController { - private SessionGuard $sessionGuard; + /** + * @var \Illuminate\Auth\SessionGuard + */ + private $authManager; + private UserUpdateService $updateService; /** * AccountController constructor. */ - public function __construct(SessionGuard $sessionGuard, UserUpdateService $updateService) + public function __construct(AuthManager $authManager, UserUpdateService $updateService) { parent::__construct(); - $this->sessionGuard = $sessionGuard; + $this->authManager = $authManager; $this->updateService = $updateService; } /** * Gets information about the currently authenticated user. - * - * @throws \Illuminate\Contracts\Container\BindingResolutionException */ public function index(Request $request): array { @@ -40,9 +42,6 @@ class AccountController extends ClientApiController /** * Update the authenticated user's email address. - * - * @throws \Pterodactyl\Exceptions\Model\DataValidationException - * @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException */ public function updateEmail(UpdateEmailRequest $request): Response { @@ -65,9 +64,9 @@ class AccountController extends ClientApiController // cached copy of the user that does not include the updated password. Do this // to correctly store the new user details in the guard and allow the logout // other devices functionality to work. - $this->sessionGuard->setUser($user); + $this->authManager->setUser($user); - $this->sessionGuard->logoutOtherDevices($request->input('password')); + $this->authManager->logoutOtherDevices($request->input('password')); return $this->returnNoContent(); } diff --git a/app/Services/Users/UserUpdateService.php b/app/Services/Users/UserUpdateService.php index 31f4010b6..a09a0a1a1 100644 --- a/app/Services/Users/UserUpdateService.php +++ b/app/Services/Users/UserUpdateService.php @@ -25,8 +25,6 @@ class UserUpdateService /** * Update the user model instance and return the updated model. - * - * @throws \Throwable */ public function handle(User $user, array $data): User {