update: fix user generate

This commit is contained in:
tokumeikoi
2021-10-06 00:20:28 +08:00
parent a6d5a433b0
commit b40272a8fa
4 changed files with 25 additions and 2 deletions

View File

@ -179,6 +179,9 @@ class UserController extends Controller
'uuid' => Helper::guid(true),
'token' => Helper::guid()
];
if (User::where('email', $user['email'])->first()) {
abort(500, '邮箱已存在于系统中');
}
$user['password'] = password_hash($request->input('password') ?? $user['email'], PASSWORD_DEFAULT);
if (!User::create($user)) {
abort(500, '生成失败');