hopefully fix integration tests

This commit is contained in:
Matthew Penner 2021-10-06 14:45:44 -06:00
parent 7ec78d9400
commit d945ce76f2
No known key found for this signature in database
GPG Key ID: BAB67850901908A8
2 changed files with 10 additions and 13 deletions

View File

@ -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();
}

View File

@ -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
{