mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-20 03:38:06 +02:00
Fix Artisan command calling a deprecated service method
This commit is contained in:
parent
35b5f26923
commit
9bf165895f
@ -4,10 +4,7 @@ namespace App\Console\Commands\Maintenance;
|
|||||||
|
|
||||||
use App\Models\TwoFAccount;
|
use App\Models\TwoFAccount;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
@ -68,7 +65,6 @@ class FixUnsplittedAccounts extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->line('Try to fix them...');
|
$this->line('Try to fix them...');
|
||||||
$twofaccountService = resolve('App\Services\TwoFAccountService');
|
|
||||||
|
|
||||||
foreach ($twofaccounts as $twofaccount) {
|
foreach ($twofaccounts as $twofaccount) {
|
||||||
if ($twofaccount->legacy_uri === __('errors.indecipherable')) {
|
if ($twofaccount->legacy_uri === __('errors.indecipherable')) {
|
||||||
@ -77,16 +73,9 @@ class FixUnsplittedAccounts extends Command
|
|||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
// Get a consistent account
|
// Get a consistent account
|
||||||
$tempAccount = $twofaccountService->createFromUri($twofaccount->legacy_uri, false);
|
$twofaccount->fillWithURI($twofaccount->legacy_uri, false, true);
|
||||||
|
|
||||||
$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->save();
|
$twofaccount->save();
|
||||||
|
|
||||||
$this->info(sprintf('Account #%d fixed', $twofaccount->id));
|
$this->info(sprintf('Account #%d fixed', $twofaccount->id));
|
||||||
}
|
}
|
||||||
catch (\Exception $ex) {
|
catch (\Exception $ex) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user