部分前台接口
This commit is contained in:
@@ -28,11 +28,16 @@ class UserController extends BaseController
|
||||
*/
|
||||
public function changePassword(): JsonResponse
|
||||
{
|
||||
$this->insertField = ['password', 'new_password'];
|
||||
$this->insertField = ['old_password', 'new_password', 'confirm_password'];
|
||||
$params = $this->checkRequiredFields(request()->post());
|
||||
|
||||
if ($params['old_password'] === $params['new_password']) {
|
||||
return jerr('新密码不能与旧密码相同');
|
||||
} elseif ($params['new_password'] !== $params['confirm_password']) {
|
||||
return jerr('新密码与确认密码不一致');
|
||||
}
|
||||
return jok(
|
||||
$this->service->changePassword($params['password'], $params['new_password']),
|
||||
$this->service->changePassword($params['old_password'], $params['new_password']),
|
||||
'重置密码成功'
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user