Use more standardized phpcs
This commit is contained in:
parent
a043071e3c
commit
c449ca5155
493 changed files with 1116 additions and 3903 deletions
|
@ -41,12 +41,6 @@ class ToggleTwoFactorService
|
|||
|
||||
/**
|
||||
* ToggleTwoFactorService constructor.
|
||||
*
|
||||
* @param \Illuminate\Database\ConnectionInterface $connection
|
||||
* @param \Illuminate\Contracts\Encryption\Encrypter $encrypter
|
||||
* @param \PragmaRX\Google2FA\Google2FA $google2FA
|
||||
* @param \Pterodactyl\Repositories\Eloquent\RecoveryTokenRepository $recoveryTokenRepository
|
||||
* @param \Pterodactyl\Contracts\Repository\UserRepositoryInterface $repository
|
||||
*/
|
||||
public function __construct(
|
||||
ConnectionInterface $connection,
|
||||
|
@ -65,9 +59,6 @@ class ToggleTwoFactorService
|
|||
/**
|
||||
* Toggle 2FA on an account only if the token provided is valid.
|
||||
*
|
||||
* @param \Pterodactyl\Models\User $user
|
||||
* @param string $token
|
||||
* @param bool|null $toggleState
|
||||
* @return string[]
|
||||
*
|
||||
* @throws \Throwable
|
||||
|
@ -82,7 +73,7 @@ class ToggleTwoFactorService
|
|||
|
||||
$isValidToken = $this->google2FA->verifyKey($secret, $token, config()->get('pterodactyl.auth.2fa.window'));
|
||||
|
||||
if (! $isValidToken) {
|
||||
if (!$isValidToken) {
|
||||
throw new TwoFactorAuthenticationTokenInvalid('The token provided is not valid.');
|
||||
}
|
||||
|
||||
|
@ -95,9 +86,9 @@ class ToggleTwoFactorService
|
|||
// which will then be marked as deleted from the database and will also bypass 2FA protections
|
||||
// on their account.
|
||||
$tokens = [];
|
||||
if ((! $toggleState && ! $user->use_totp) || $toggleState) {
|
||||
if ((!$toggleState && !$user->use_totp) || $toggleState) {
|
||||
$inserts = [];
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
for ($i = 0; $i < 10; ++$i) {
|
||||
$token = Str::random(10);
|
||||
|
||||
$inserts[] = [
|
||||
|
@ -118,7 +109,7 @@ class ToggleTwoFactorService
|
|||
|
||||
$this->repository->withoutFreshModel()->update($user->id, [
|
||||
'totp_authenticated_at' => Carbon::now(),
|
||||
'use_totp' => (is_null($toggleState) ? ! $user->use_totp : $toggleState),
|
||||
'use_totp' => (is_null($toggleState) ? !$user->use_totp : $toggleState),
|
||||
]);
|
||||
|
||||
return $tokens;
|
||||
|
|
Reference in a new issue