mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-04-15 21:18:25 +02:00
Merge hotfixes for v3.4.2 into dev
This commit is contained in:
commit
05eafe51ac
@ -66,12 +66,13 @@ private function isGoogleAuth(string $migrationPayload) : bool
|
|||||||
*/
|
*/
|
||||||
private function isPlainText(string $migrationPayload) : bool
|
private function isPlainText(string $migrationPayload) : bool
|
||||||
{
|
{
|
||||||
// - Plain text : one or more otpauth URIs (otpauth://[t|h]otp/...), one per line
|
// - Plain text : one or more otpauth URIs (otpauth://(hotp|totp|steam)/...), one per line
|
||||||
|
|
||||||
return Validator::make(
|
return Validator::make(
|
||||||
preg_split('~\R~', $migrationPayload, -1, PREG_SPLIT_NO_EMPTY),
|
preg_split('~\R~', $migrationPayload, -1, PREG_SPLIT_NO_EMPTY),
|
||||||
[
|
[
|
||||||
'*' => 'regex:/^otpauth:\/\/[h,t]otp\//i',
|
// The regex rule must be embraced with brackets when it cointains a pipe
|
||||||
|
'*' => ['regex:/^otpauth:\/\/(?:steam|totp|hotp)\//i'],
|
||||||
]
|
]
|
||||||
)->passes();
|
)->passes();
|
||||||
}
|
}
|
||||||
|
@ -394,8 +394,9 @@ public function fillWithURI(string $uri, bool $isSteamTotp = false, bool $skipIc
|
|||||||
{
|
{
|
||||||
// First we instanciate the OTP generator
|
// First we instanciate the OTP generator
|
||||||
try {
|
try {
|
||||||
$this->generator = Factory::loadFromProvisioningUri($uri);
|
$this->generator = Factory::loadFromProvisioningUri($isSteamTotp ? str_replace('otpauth://steam', 'otpauth://totp', $uri) : $uri);
|
||||||
} catch (\Assert\AssertionFailedException | \Assert\InvalidArgumentException | \Exception | \Throwable $ex) {
|
}
|
||||||
|
catch (\Assert\AssertionFailedException|\Assert\InvalidArgumentException|\Exception|\Throwable $ex) {
|
||||||
throw ValidationException::withMessages([
|
throw ValidationException::withMessages([
|
||||||
'uri' => __('validation.custom.uri.regex', ['attribute' => 'uri']),
|
'uri' => __('validation.custom.uri.regex', ['attribute' => 'uri']),
|
||||||
]);
|
]);
|
||||||
@ -459,6 +460,7 @@ public function equals(self $other) : bool
|
|||||||
private function enforceAsSteam() : void
|
private function enforceAsSteam() : void
|
||||||
{
|
{
|
||||||
$this->otp_type = self::STEAM_TOTP;
|
$this->otp_type = self::STEAM_TOTP;
|
||||||
|
$this->service = 'Steam';
|
||||||
$this->digits = 5;
|
$this->digits = 5;
|
||||||
$this->algorithm = self::SHA1;
|
$this->algorithm = self::SHA1;
|
||||||
$this->period = 30;
|
$this->period = 30;
|
||||||
|
@ -21,7 +21,7 @@ public function migrate(mixed $migrationPayload) : Collection
|
|||||||
{
|
{
|
||||||
$otpauthURIs = preg_split('~\R~', $migrationPayload);
|
$otpauthURIs = preg_split('~\R~', $migrationPayload);
|
||||||
$otpauthURIs = Arr::where($otpauthURIs, function ($value, $key) {
|
$otpauthURIs = Arr::where($otpauthURIs, function ($value, $key) {
|
||||||
return Str::startsWith($value, ['otpauth://totp/', 'otpauth://hotp/']);
|
return Str::startsWith($value, ['otpauth://totp/', 'otpauth://hotp/', 'otpauth://steam/']);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (count($otpauthURIs) < 1) {
|
if (count($otpauthURIs) < 1) {
|
||||||
@ -31,9 +31,11 @@ public function migrate(mixed $migrationPayload) : Collection
|
|||||||
|
|
||||||
foreach ($otpauthURIs as $key => $uri) {
|
foreach ($otpauthURIs as $key => $uri) {
|
||||||
try {
|
try {
|
||||||
$twofaccounts[$key] = new TwoFAccount;
|
$twofaccounts[$key] = new TwoFAccount;
|
||||||
$twofaccounts[$key]->fillWithURI($uri);
|
$twofaccounts[$key]->fillWithURI($uri, str_starts_with($uri, 'otpauth://steam/'));
|
||||||
} catch (\Exception $exception) {
|
}
|
||||||
|
catch (\Exception $exception) {
|
||||||
|
|
||||||
Log::error(sprintf('Cannot instanciate a TwoFAccount object with OTP parameters from imported item #%s', $key));
|
Log::error(sprintf('Cannot instanciate a TwoFAccount object with OTP parameters from imported item #%s', $key));
|
||||||
Log::debug($exception->getMessage());
|
Log::debug($exception->getMessage());
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
# Change log
|
# Change log
|
||||||
|
|
||||||
|
## [3.4.2] - 2023-01-25
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- [issue #160](https://github.com/Bubka/2FAuth/issues/160) Steam otpauth URI from Aegis are rejected by the Import feature
|
||||||
|
|
||||||
## [3.4.1] - 2022-11-25
|
## [3.4.1] - 2022-11-25
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'version' => '3.4.1',
|
'version' => '3.4.2',
|
||||||
'repository' => 'https://github.com/Bubka/2FAuth',
|
'repository' => 'https://github.com/Bubka/2FAuth',
|
||||||
'latestReleaseUrl' => 'https://api.github.com/repos/Bubka/2FAuth/releases/latest',
|
'latestReleaseUrl' => 'https://api.github.com/repos/Bubka/2FAuth/releases/latest',
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user