From 2067b1138af7a1a010f81007c90d31112652fcba Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 20 Mar 2024 23:43:58 +0000 Subject: [PATCH] Added the log item Signed-off-by: snipe --- app/Http/Controllers/Api/UsersController.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/Http/Controllers/Api/UsersController.php b/app/Http/Controllers/Api/UsersController.php index 6d32e8b6f2..cacfe7662b 100644 --- a/app/Http/Controllers/Api/UsersController.php +++ b/app/Http/Controllers/Api/UsersController.php @@ -663,6 +663,16 @@ class UsersController extends Controller $user->two_factor_enrolled = 0; $user->save(); + // Log the reset + $logaction = new Actionlog(); + $logaction->target_type = User::class; + $logaction->target_id = $user->id; + $logaction->item_type = User::class; + $logaction->item_id = $user->id; + $logaction->created_at = date('Y-m-d H:i:s'); + $logaction->user_id = Auth::user()->id; + $logaction->logaction('2FA reset'); + return response()->json(['message' => trans('admin/settings/general.two_factor_reset_success')], 200); } catch (\Exception $e) { return response()->json(['message' => trans('admin/settings/general.two_factor_reset_error')], 500);