agent_9art/fix-admin-password.sh
jiao d327826c78 chore: 完成项目整体打包与配置更新
1. 更新所有服务Dockerfile,切换到eclipse-temurin:17-jre-alpine镜像并调整服务端口
2. 配置前端项目基础路径与nginx代理
3. 新增数据库初始化编码设置与测试依赖
4. 添加部分服务的Servlet编码配置与JWT/LLM密钥配置
5. 完善话术实体类校验注解与Mapper接口
6. 新增密码生成工具类与部分测试文件配置
2026-05-21 11:40:22 +08:00

29 lines
1.1 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.

#!/bin/bash
# 在服务器上执行,重置 admin 密码为 admin123
cd /www/wwwroot/deploy-package
# 生成新的 BCrypt 哈希(strength=10)
# 使用 Java 生成
NEW_HASH=$(docker run --rm eclipse-temurin:17-jre-alpine sh -c '
wget -q https://repo1.maven.org/maven2/org/springframework/security/spring-security-crypto/5.8.0/spring-security-crypto-5.8.0.jar -O /tmp/crypto.jar 2>/dev/null || true
java -cp "/tmp/crypto.jar" -version 2>&1 | head -1
')
echo "直接在 MySQL 中更新密码哈希..."
# 这个哈希是通过 BCryptPasswordEncoder 对 "admin123" 加密得到的(strength=10)
# 你可以用在线工具验证:https://bcrypt-generator.com/
HASH='$2a$10$N.zmdr9k7uOCQb376NoUnuTJ8iAt6Z5EHsM8lE9lBOsl7iOE1Qh6G'
docker exec -i ai-assistant-mysql mysql -uroot -proot -e "
UPDATE ai_assistant.admins SET password = '${HASH}' WHERE username = 'admin';
SELECT username, password FROM ai_assistant.admins WHERE username = 'admin';
" 2>&1
echo ""
echo "测试登录..."
curl -s -X POST http://localhost:8087/api/v1/admin/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin","password":"admin123"}'