Files
AIGC/demo/fix-login-loop-test.sh
2025-10-21 16:50:33 +08:00

46 lines
1.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 登录循环问题修复验证
echo "=== 登录循环问题修复验证 ==="
echo "1. 检查前端服务状态..."
if curl -s http://localhost:3000 > /dev/null; then
echo "✅ 前端服务运行正常"
else
echo "❌ 前端服务未运行"
echo " 启动命令: cd demo/frontend && yarn dev"
fi
echo -e "\n2. 检查后端服务状态..."
if curl -s http://localhost:8080/api/public/health > /dev/null; then
echo "✅ 后端服务运行正常"
else
echo "❌ 后端服务未运行"
echo " 启动命令: cd demo && ./mvnw spring-boot:run"
fi
echo -e "\n3. 测试登录API..."
echo " 测试命令: curl -X POST http://localhost:8080/api/auth/login"
echo " 参数: {\"username\":\"admin\",\"password\":\"admin\"}"
echo -e "\n4. 检查浏览器控制台..."
echo " 打开浏览器开发者工具查看Console输出"
echo " 应该看到详细的路由守卫日志"
echo -e "\n5. 测试步骤..."
echo " 1. 访问 http://localhost:3000/login"
echo " 2. 使用管理员账户登录 (admin/admin)"
echo " 3. 观察控制台日志"
echo " 4. 检查是否成功跳转到首页"
echo -e "\n=== 修复内容 ==="
echo "✅ 增强了路由守卫的调试日志"
echo "✅ 修复了用户状态恢复逻辑"
echo "✅ 添加了登录成功后的延迟处理"
echo "✅ 改进了错误处理和状态管理"
echo -e "\n=== 如果仍有问题 ==="
echo "1. 检查浏览器控制台的详细日志"
echo "2. 确认后端JWT配置正确"
echo "3. 检查网络请求是否成功"
echo "4. 验证用户角色是否为ROLE_ADMIN"