Fix Artisan command calling a deprecated service method

This commit is contained in:
Bubka 2022-07-28 22:01:33 +02:00
parent 35b5f26923
commit 9bf165895f

View File

@ -4,10 +4,7 @@
use App\Models\TwoFAccount;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\Log;
/**
* @codeCoverageIgnore
@ -68,7 +65,6 @@ public function handle()
}
$this->line('Try to fix them...');
$twofaccountService = resolve('App\Services\TwoFAccountService');
foreach ($twofaccounts as $twofaccount) {
if ($twofaccount->legacy_uri === __('errors.indecipherable')) {
@ -77,16 +73,9 @@ public function handle()
else {
try {
// Get a consistent account
$tempAccount = $twofaccountService->createFromUri($twofaccount->legacy_uri, false);
$twofaccount->otp_type = $tempAccount->otp_type;
$twofaccount->secret = $tempAccount->secret;
$twofaccount->algorithm = $tempAccount->algorithm;
$twofaccount->digits = $tempAccount->digits;
$twofaccount->period = $tempAccount->period;
$twofaccount->counter = $tempAccount->counter;
$twofaccount->fillWithURI($twofaccount->legacy_uri, false, true);
$twofaccount->save();
$this->info(sprintf('Account #%d fixed', $twofaccount->id));
}
catch (\Exception $ex) {