Skip to content

Commit 0f0a9d5

Browse files
committed
Update LoginController
1 parent 49635eb commit 0f0a9d5

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

app/Http/Controllers/Auth/LoginController.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
use App\Http\Controllers\Controller;
66
use App\Rules\HCaptchaRule;
77
use App\Rules\TurnstileRule;
8+
use App\Services\AccountService;
89
use App\Services\CaptchaService;
910
use Illuminate\Foundation\Auth\AuthenticatesUsers;
1011
use Illuminate\Http\JsonResponse;
1112
use Illuminate\Http\Request;
13+
use Illuminate\Support\Facades\DB;
1214
use Illuminate\Support\Facades\Session;
1315

1416
class LoginController extends Controller
@@ -194,13 +196,16 @@ protected function authenticated(Request $request, $user)
194196

195197
if (in_array($user->status, [7, 8])) {
196198
$hasRecovered = true;
197-
$user->update(['status' => 1, 'delete_after' => null]);
198-
$user->profile->update(['status' => 1]);
199-
$user->videos()->whereIn('status', [7, 8])->update(['status' => 2]);
200-
$user->videos()->whereIn('status', [9])->update(['status' => 1]);
201-
$user->comments()->whereIn('status', ['account_pending_deletion', 'account_disabled'])->update(['status' => 'active']);
202-
$user->commentReplies()->whereIn('status', ['account_pending_deletion', 'account_disabled'])->update(['status' => 'active']);
203-
$user->actorNotifications()->whereIn('actor_state', [7, 8])->update(['actor_state' => 1]);
199+
DB::transaction(function () use ($user) {
200+
$user->update(['status' => 1, 'delete_after' => null]);
201+
$user->profile->update(['status' => 1]);
202+
$user->videos()->whereIn('status', [7, 8])->update(['status' => 2]);
203+
$user->videos()->whereIn('status', [9])->update(['status' => 1]);
204+
$user->comments()->whereIn('status', ['account_pending_deletion', 'account_disabled'])->update(['status' => 'active']);
205+
$user->commentReplies()->whereIn('status', ['account_pending_deletion', 'account_disabled'])->update(['status' => 'active']);
206+
$user->actorNotifications()->whereIn('actor_state', [7, 8])->update(['actor_state' => 1]);
207+
AccountService::del($user->profile_id);
208+
});
204209
}
205210

206211
if ($intendedUrl && str_contains($intendedUrl, '/oauth/authorize')) {

0 commit comments

Comments
 (0)