Merge branch 'develop' into v2

This commit is contained in:
Matthew Penner 2021-08-03 14:41:12 -06:00
commit a39802cb4e
19 changed files with 241 additions and 99 deletions

View file

@ -48,9 +48,7 @@ class TwoFactorController extends ClientApiController
}
return new JsonResponse([
'data' => [
'image_url_data' => $this->setupService->handle($request->user()),
],
'data' => $this->setupService->handle($request->user()),
]);
}

View file

@ -49,7 +49,7 @@ class TwoFactorSetupService
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function handle(User $user): string
public function handle(User $user): array
{
$secret = '';
try {
@ -66,11 +66,14 @@ class TwoFactorSetupService
$company = urlencode(preg_replace('/\s/', '', $this->config->get('app.name')));
return sprintf(
'otpauth://totp/%1$s:%2$s?secret=%3$s&issuer=%1$s',
rawurlencode($company),
rawurlencode($user->email),
rawurlencode($secret)
);
return [
'image_url_data' => sprintf(
'otpauth://totp/%1$s:%2$s?secret=%3$s&issuer=%1$s',
rawurlencode($company),
rawurlencode($user->email),
rawurlencode($secret),
),
'secret' => $secret,
];
}
}