From 8e0897f89d1035bedd78bdd4ce7b9913e62a2efb Mon Sep 17 00:00:00 2001 From: root Date: Fri, 25 Oct 2019 15:33:14 +0800 Subject: [PATCH] update --- app/Http/Controllers/Admin/UserController.php | 3 +++ app/Http/Requests/Admin/UserSave.php | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index e84e745f..d2fff23b 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -37,6 +37,9 @@ class UserController extends Controller if (User::where('email', $request->input('email')->first())) { abort(500, '邮箱已被使用'); } + if ($request->input('id') && !$request->input('password')) { + abort(500, '密码不能为空'); + } $user->email = $request->input('email'); $user->password = password_hash($request->input('password'), PASSWORD_DEFAULT); $user->transfer_enable = $request->input('transfer_enable') * 1073741824; diff --git a/app/Http/Requests/Admin/UserSave.php b/app/Http/Requests/Admin/UserSave.php index 81f52fae..f473bd15 100644 --- a/app/Http/Requests/Admin/UserSave.php +++ b/app/Http/Requests/Admin/UserSave.php @@ -4,7 +4,7 @@ namespace App\Http\Requests\Admin; use Illuminate\Foundation\Http\FormRequest; -class ServerSave extends FormRequest +class UserSave extends FormRequest { /** * Get the validation rules that apply to the request. @@ -15,7 +15,6 @@ class ServerSave extends FormRequest { return [ 'email' => 'required|email', - 'password' => 'required', 'transfer_enable' => 'numeric', 'expired_at' => 'integer', 'banned' => 'required|in:0,1', @@ -28,7 +27,6 @@ class ServerSave extends FormRequest return [ 'email.required' => '邮箱不能为空', 'email.email' => '邮箱格式不正确', - 'password.required' => '密码不能为空', 'transfer_enable.numeric' => '流量格式不正确', 'expired_at.integer' => '到期时间格式不正确', 'banned.required' => '是否封禁不能为空',