hopefully fix integration tests
This commit is contained in:
parent
7ec78d9400
commit
d945ce76f2
2 changed files with 10 additions and 13 deletions
|
@ -4,7 +4,7 @@ namespace Pterodactyl\Http\Controllers\Api\Client;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Auth\SessionGuard;
|
use Illuminate\Auth\AuthManager;
|
||||||
use Pterodactyl\Services\Users\UserUpdateService;
|
use Pterodactyl\Services\Users\UserUpdateService;
|
||||||
use Pterodactyl\Transformers\Api\Client\AccountTransformer;
|
use Pterodactyl\Transformers\Api\Client\AccountTransformer;
|
||||||
use Pterodactyl\Http\Requests\Api\Client\Account\UpdateEmailRequest;
|
use Pterodactyl\Http\Requests\Api\Client\Account\UpdateEmailRequest;
|
||||||
|
@ -12,24 +12,26 @@ use Pterodactyl\Http\Requests\Api\Client\Account\UpdatePasswordRequest;
|
||||||
|
|
||||||
class AccountController extends ClientApiController
|
class AccountController extends ClientApiController
|
||||||
{
|
{
|
||||||
private SessionGuard $sessionGuard;
|
/**
|
||||||
|
* @var \Illuminate\Auth\SessionGuard
|
||||||
|
*/
|
||||||
|
private $authManager;
|
||||||
|
|
||||||
private UserUpdateService $updateService;
|
private UserUpdateService $updateService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AccountController constructor.
|
* AccountController constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct(SessionGuard $sessionGuard, UserUpdateService $updateService)
|
public function __construct(AuthManager $authManager, UserUpdateService $updateService)
|
||||||
{
|
{
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
$this->sessionGuard = $sessionGuard;
|
$this->authManager = $authManager;
|
||||||
$this->updateService = $updateService;
|
$this->updateService = $updateService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets information about the currently authenticated user.
|
* Gets information about the currently authenticated user.
|
||||||
*
|
|
||||||
* @throws \Illuminate\Contracts\Container\BindingResolutionException
|
|
||||||
*/
|
*/
|
||||||
public function index(Request $request): array
|
public function index(Request $request): array
|
||||||
{
|
{
|
||||||
|
@ -40,9 +42,6 @@ class AccountController extends ClientApiController
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the authenticated user's email address.
|
* Update the authenticated user's email address.
|
||||||
*
|
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
|
||||||
*/
|
*/
|
||||||
public function updateEmail(UpdateEmailRequest $request): Response
|
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
|
// 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
|
// to correctly store the new user details in the guard and allow the logout
|
||||||
// other devices functionality to work.
|
// 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();
|
return $this->returnNoContent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,6 @@ class UserUpdateService
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the user model instance and return the updated model.
|
* Update the user model instance and return the updated model.
|
||||||
*
|
|
||||||
* @throws \Throwable
|
|
||||||
*/
|
*/
|
||||||
public function handle(User $user, array $data): User
|
public function handle(User $user, array $data): User
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue