Files
AIclinicalresearch/redcap-docker-dev/scripts/create-redcap-password.php
HaHafeng 2481b786d8 deploy: Complete 0126-27 deployment - database upgrade, services update, code recovery
Major Changes:
- Database: Install pg_bigm/pgvector plugins, create test database
- Python service: v1.0 -> v1.1, add pymupdf4llm/openpyxl/pypandoc
- Node.js backend: v1.3 -> v1.7, fix pino-pretty and ES Module imports
- Frontend: v1.2 -> v1.3, skip TypeScript check for deployment
- Code recovery: Restore empty files from local backup

Technical Fixes:
- Fix pino-pretty error in production (conditional loading)
- Fix ES Module import paths (add .js extensions)
- Fix OSSAdapter TypeScript errors
- Update Prisma Schema (63 models, 16 schemas)
- Update environment variables (DATABASE_URL, EXTRACTION_SERVICE_URL, OSS)
- Remove deprecated variables (REDIS_URL, DIFY_API_URL, DIFY_API_KEY)

Documentation:
- Create 0126 deployment folder with 8 documents
- Update database development standards v2.0
- Update SAE deployment status records

Deployment Status:
- PostgreSQL: ai_clinical_research_test with plugins
- Python: v1.1 @ 172.17.173.84:8000
- Backend: v1.7 @ 172.17.173.89:3001
- Frontend: v1.3 @ 172.17.173.90:80

Tested: All services running successfully on SAE
2026-01-27 08:13:27 +08:00

88 lines
1.6 KiB
PHP
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.
<?php
/**
* REDCap密码哈希生成脚本
* 直接在数据库中更新Admin密码
*/
// REDCap密码哈希算法SHA-512 + Salt
$username = 'Admin';
$new_password = 'Admin123!';
// 生成新的saltREDCap使用100字符的随机salt
$salt = '';
$characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_=+[]{}|;:,.<>?~';
for ($i = 0; $i < 100; $i++) {
$salt .= $characters[random_int(0, strlen($characters) - 1)];
}
// 生成密码哈希SHA-512(password + salt)
$password_hash = hash('sha512', $new_password . $salt);
// 数据库连接信息
$db_host = getenv('REDCAP_DB_HOST') ?: 'redcap-mysql';
$db_name = getenv('REDCAP_DB_NAME') ?: 'redcap';
$db_user = getenv('REDCAP_DB_USER') ?: 'redcap_user';
$db_pass = getenv('REDCAP_DB_PASS') ?: 'redcap_pass_dev_456';
try {
$pdo = new PDO("mysql:host=$db_host;dbname=$db_name", $db_user, $db_pass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// 更新密码
$stmt = $pdo->prepare("UPDATE redcap_auth SET password = ?, password_salt = ? WHERE username = ?");
$result = $stmt->execute([$password_hash, $salt, $username]);
if ($result) {
echo "✅ Password updated successfully!\n\n";
echo "Username: $username\n";
echo "New Password: $new_password\n\n";
echo "You can now login at: http://localhost:8080/\n";
} else {
echo "❌ Failed to update password\n";
}
} catch (PDOException $e) {
echo "❌ Database error: " . $e->getMessage() . "\n";
}