Fix changing a user password to not incorrectly handle logging out old sessions; closes #3531
This commit is contained in:
parent
25d9ba4779
commit
2b3303c46b
5 changed files with 32 additions and 28 deletions
|
@ -3,6 +3,8 @@
|
|||
namespace Pterodactyl\Http\Requests\Api\Client\Account;
|
||||
|
||||
use Pterodactyl\Models\User;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Contracts\Hashing\Hasher;
|
||||
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
||||
use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException;
|
||||
|
||||
|
@ -17,8 +19,10 @@ class UpdateEmailRequest extends ClientApiRequest
|
|||
return false;
|
||||
}
|
||||
|
||||
$hasher = Container::getInstance()->make(Hasher::class);
|
||||
|
||||
// Verify password matches when changing password or email.
|
||||
if (!password_verify($this->input('password'), $this->user()->password)) {
|
||||
if (!$hasher->check($this->input('password'), $this->user()->password)) {
|
||||
throw new InvalidPasswordProvidedException(trans('validation.internal.invalid_password'));
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace Pterodactyl\Http\Requests\Api\Client\Account;
|
||||
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Contracts\Hashing\Hasher;
|
||||
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
|
||||
use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException;
|
||||
|
||||
|
@ -16,8 +18,10 @@ class UpdatePasswordRequest extends ClientApiRequest
|
|||
return false;
|
||||
}
|
||||
|
||||
$hasher = Container::getInstance()->make(Hasher::class);
|
||||
|
||||
// Verify password matches when changing password or email.
|
||||
if (!password_verify($this->input('current_password'), $this->user()->password)) {
|
||||
if (!$hasher->check($this->input('current_password'), $this->user()->password)) {
|
||||
throw new InvalidPasswordProvidedException(trans('validation.internal.invalid_password'));
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue