fix(security): resolve F-03 — fix inverted is_blocked checkbox logic, rename to unblock_account for semantic clarity
This commit is contained in:
@@ -189,22 +189,13 @@ class AdminController extends Controller
|
||||
]);
|
||||
|
||||
DB::transaction(function () use ($request, $validated, $userid) {
|
||||
if ($request->has('is_blocked'))
|
||||
{
|
||||
DB::table('users')->where('id',$userid)
|
||||
->update([
|
||||
'is_blocked' => 0,
|
||||
'login_attempts' => 0,
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
}else{
|
||||
DB::table('users')->where('id',$userid)
|
||||
->update([
|
||||
'is_blocked' => 1,
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
$isBlocked = !$request->has('unblock_account');
|
||||
DB::table('users')->where('id',$userid)
|
||||
->update([
|
||||
'is_blocked' => $isBlocked ? 1 : 0,
|
||||
'login_attempts' => $isBlocked ? DB::raw('login_attempts') : 0,
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
|
||||
DB::table('users')->where('id',$userid)
|
||||
->update([
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
<div class="col-md-6 mb-3 ">
|
||||
<label class="form-label mb-0">@lang('messages.accstatus'):</label>
|
||||
<div class="form-check form-switch ms-2">
|
||||
<input type="checkbox" class="form-check-input" id="unblock{{ $row->id }}" name="is_blocked" value="0" {{ $row->is_blocked ? '' : 'checked' }}>
|
||||
<input type="checkbox" class="form-check-input" id="unblock{{ $row->id }}" name="unblock_account" value="1" {{ $row->is_blocked ? '' : 'checked' }}>
|
||||
<label class="form-check-label" for="unblock{{ $row->id }}">
|
||||
{{ $row->is_blocked ? __('messages.block') : __('messages.active') }}
|
||||
</label>
|
||||
|
||||
Reference in New Issue
Block a user