|
5 | 5 | use App\Http\Controllers\Controller; |
6 | 6 | use App\Rules\HCaptchaRule; |
7 | 7 | use App\Rules\TurnstileRule; |
| 8 | +use App\Services\AccountService; |
8 | 9 | use App\Services\CaptchaService; |
9 | 10 | use Illuminate\Foundation\Auth\AuthenticatesUsers; |
10 | 11 | use Illuminate\Http\JsonResponse; |
11 | 12 | use Illuminate\Http\Request; |
| 13 | +use Illuminate\Support\Facades\DB; |
12 | 14 | use Illuminate\Support\Facades\Session; |
13 | 15 |
|
14 | 16 | class LoginController extends Controller |
@@ -194,13 +196,16 @@ protected function authenticated(Request $request, $user) |
194 | 196 |
|
195 | 197 | if (in_array($user->status, [7, 8])) { |
196 | 198 | $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 | + }); |
204 | 209 | } |
205 | 210 |
|
206 | 211 | if ($intendedUrl && str_contains($intendedUrl, '/oauth/authorize')) { |
|
0 commit comments