Files
AIclinicalresearch/redcap-docker-dev/scripts/create-redcap-password.php
HaHafeng 5a17d096a7 feat(pkb): Complete PKB module frontend migration with V3 design
Summary:
- Implement PKB Dashboard and Workspace pages based on V3 prototype
- Add single-layer header with integrated Tab navigation
- Implement 3 work modes: Full Text, Deep Read, Batch Processing
- Integrate Ant Design X Chat component for AI conversations
- Create BatchModeComplete with template selection and document processing
- Add compact work mode selector with dropdown design

Backend:
- Migrate PKB controllers and services to /modules/pkb structure
- Register v2 API routes at /api/v2/pkb/knowledge
- Maintain dual API routes for backward compatibility

Technical details:
- Use Zustand for state management
- Handle SSE streaming responses for AI chat
- Support document selection for Deep Read mode
- Implement batch processing with progress tracking

Known issues:
- Batch processing API integration pending
- Knowledge assets page navigation needs optimization

Status: Frontend functional, pending refinement
2026-01-06 22:15:42 +08:00

56 lines
1.5 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";
}