Browse Source

Fix 手动编辑用户会清空用户密码错误

兔姬桑 4 years ago
parent
commit
c20781ea4c
1 changed files with 1 additions and 2 deletions
  1. 1 2
      app/Http/Controllers/Admin/UserController.php

+ 1 - 2
app/Http/Controllers/Admin/UserController.php

@@ -194,10 +194,9 @@ class UserController extends Controller
     public function update(UserUpdateRequest $request, User $user)
     {
         $data = $request->validated();
-        Arr::forget($data, 'roles');
         $data['passwd'] = $request->input('passwd') ?? Str::random();
         $data['vmess_id'] = $data['uuid'] ?? Str::uuid();
-        Arr::forget($data, 'uuid');
+        Arr::forget($data, ['roles', 'uuid', 'password']);
         $data['transfer_enable'] *= GB;
         $data['enable'] = $data['status'] < 0 ? 0 : $data['enable'];
         $data['expired_at'] = $data['expired_at'] ?? date('Y-m-d', strtotime('+365 days'));