feat: 完善鉴权和密码功能,添加飞书通知模块

- 完善Token过期/不存在时跳转登录重新认证
- 实现正常的账号密码登录验证(邮箱/手机号+密码)
- 用户初始化密码设为工号(sn)
- 添加修改密码功能(API+前端页面)
- 修复扫码登录后跳转问题(zustand persist格式)
- 创建飞书通知服务 FeishuNotificationService
- 设置页面添加修改密码入口

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
root
2026-02-26 15:19:37 +08:00
parent ba555a59b7
commit 2e5f570b40
26 changed files with 2925 additions and 158 deletions
+41
View File
@@ -60,6 +60,47 @@ class UserController extends BaseController
return $this->success();
}
/**
* 修改密码
*/
public function changePassword(Request $request): Response
{
$userId = $this->getUserId($request);
$user = User::find($userId);
if (!$user) {
return $this->error('用户不存在');
}
$oldPassword = $request->post('old_password');
$newPassword = $request->post('new_password');
$confirmPassword = $request->post('confirm_password');
// 验证参数
if (!$oldPassword || !$newPassword || !$confirmPassword) {
return $this->error('请填写完整信息');
}
if (strlen($newPassword) < 6) {
return $this->error('新密码长度不能少于6位');
}
if ($newPassword !== $confirmPassword) {
return $this->error('两次输入的密码不一致');
}
// 验证旧密码
if ($user->password && !password_verify($oldPassword, $user->password)) {
return $this->error('原密码错误');
}
// 更新密码
$user->password = password_hash($newPassword, PASSWORD_DEFAULT);
$user->save();
return $this->success(null, '密码修改成功');
}
/**
* 获取用户列表(用于选择审批人等)
*/