Update the client API to be consistent with how validation is handled

This commit is contained in:
Dane Everitt 2021-08-04 20:55:15 -07:00
parent b47d262ee0
commit 622d292f39
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
33 changed files with 59 additions and 172 deletions

View file

@ -2,20 +2,16 @@
namespace Pterodactyl\Http\Requests\Api\Client\Account;
use Pterodactyl\Http\Requests\Api\Client\ClientApiRequest;
use Pterodactyl\Http\Requests\Api\Client\AccountApiRequest;
use Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException;
class UpdatePasswordRequest extends ClientApiRequest
class UpdatePasswordRequest extends AccountApiRequest
{
/**
* @throws \Pterodactyl\Exceptions\Http\Base\InvalidPasswordProvidedException
*/
public function authorize(): bool
{
if (!parent::authorize()) {
return false;
}
// Verify password matches when changing password or email.
if (!password_verify($this->input('current_password'), $this->user()->password)) {
throw new InvalidPasswordProvidedException(trans('validation.internal.invalid_password'));