This commit is contained in:
Your Name
2026-03-27 18:06:12 +08:00
parent 9160c36735
commit 099bc1dd22
645 changed files with 276473 additions and 957 deletions
@@ -24,7 +24,7 @@ use app\adminapi\validate\LoginValidate;
*/
class LoginController extends BaseAdminController
{
public array $notNeedLogin = ['account', 'workWechatConfig', 'workWechatLogin', 'checkDbColumn'];
public array $notNeedLogin = ['account', 'workWechatConfig', 'workWechatLogin', 'checkDbColumn', 'changeFirstPassword'];
/**
* @notes 账号登录
@@ -101,6 +101,41 @@ class LoginController extends BaseAdminController
]);
}
/**
* @notes 首次登录修改密码
* @return \think\response\Json
*/
public function changeFirstPassword()
{
$password = $this->request->post('password', '');
$passwordConfirm = $this->request->post('password_confirm', '');
if (empty($password)) {
return $this->fail('请输入新密码');
}
if (strlen($password) < 6) {
return $this->fail('密码长度不能少于6位');
}
if ($password !== $passwordConfirm) {
return $this->fail('两次输入的密码不一致');
}
$token = $this->request->header('token');
if (empty($token)) {
return $this->fail('请先登录');
}
$result = (new LoginLogic())->changeFirstPassword($token, $password);
if ($result === false) {
return $this->fail(LoginLogic::getError());
}
return $this->success('密码修改成功');
}
/**
* @notes 退出登录
* @return \think\response\Json