This commit is contained in:
root 2019-10-25 15:33:14 +08:00
parent aabd80ee9e
commit 8e0897f89d
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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' => '是否封禁不能为空',