Skip to content

Commit 47c1292

Browse files
committed
Fix two-factor token creation for iOS devices, closes pterodactyl#1624
1 parent 02ac308 commit 47c1292

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ value when showing an error state.
1212
* Scrolling on email settings page now works.
1313
* Database host management will now properly display an error message to the user when there is any type of MySQL related
1414
error encountered during creation or update.
15+
* Two-factor tokens generated when a company name has a space in it will now properly be parsed on iOS authenticator devices.
1516

1617
### Added
1718
* Server listing view now displays the total used disk space for each server.

app/Services/Users/TwoFactorSetupService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function handle(User $user): string
7171
'totp_secret' => $this->encrypter->encrypt($secret),
7272
]);
7373

74-
$company = $this->config->get('app.name');
74+
$company = preg_replace('/\s/', '', $this->config->get('app.name'));
7575

7676
return sprintf(
7777
'otpauth://totp/%1$s:%2$s?secret=%3$s&issuer=%1$s',

tests/Unit/Services/Users/TwoFactorSetupServiceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testSecretAndImageAreReturned()
6060
$response = $this->getService()->handle($model);
6161
$this->assertNotEmpty($response);
6262

63-
$companyName = preg_quote(rawurlencode('Company Name'));
63+
$companyName = preg_quote(rawurlencode('CompanyName'));
6464
$email = preg_quote(rawurlencode($model->email));
6565

6666
$this->assertRegExp(

0 commit comments

Comments
 (0)