From 8e397fb5cabcd3848bc4e031bd414392c796f98f Mon Sep 17 00:00:00 2001 From: Bubka <858858+Bubka@users.noreply.github.com> Date: Mon, 25 Jul 2022 17:08:49 +0200 Subject: [PATCH] Fix #103 - Remove replicated service's name in account's name during G-Auth import --- app/Services/TwoFAccountService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/TwoFAccountService.php b/app/Services/TwoFAccountService.php index cb3f9f73..91667627 100644 --- a/app/Services/TwoFAccountService.php +++ b/app/Services/TwoFAccountService.php @@ -86,8 +86,8 @@ class TwoFAccountService try { $parameters['otp_type'] = GAuthValueMapping::OTP_TYPE[OtpType::name($otp_parameters->getType())]; - $parameters['account'] = $otp_parameters->getName(); $parameters['service'] = $otp_parameters->getIssuer(); + $parameters['account'] = str_replace($parameters['service'].':', '', $otp_parameters->getName()); $parameters['secret'] = Base32::encodeUpper($otp_parameters->getSecret()); $parameters['algorithm'] = GAuthValueMapping::ALGORITHM[Algorithm::name($otp_parameters->getAlgorithm())]; $parameters['digits'] = GAuthValueMapping::DIGIT_COUNT[DigitCount::name($otp_parameters->getDigits())];