mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Implement an emergency endpoint for resetting the admin password in production, and enhance the default admin user creation logic to handle password migrations and force resets. Also, introduce a new script for resetting the admin password. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 54292eb6-296c-47a3-8f4e-c9967863556c Replit-Commit-Checkpoint-Type: full_checkpoint
37 lines
1000 B
JavaScript
37 lines
1000 B
JavaScript
#!/usr/bin/env node
|
|
|
|
// Script pour réinitialiser le mot de passe admin en production
|
|
// Usage: node reset-admin.js [URL_PRODUCTION]
|
|
|
|
const url = process.argv[2] || 'http://localhost:3000';
|
|
const endpoint = `${url}/api/emergency-admin-reset`;
|
|
|
|
const resetPassword = async () => {
|
|
try {
|
|
console.log(`🔄 Tentative de réinitialisation admin sur ${url}...`);
|
|
|
|
const response = await fetch(endpoint, {
|
|
method: 'POST',
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
secret: 'logiflow-admin-reset-2025'
|
|
})
|
|
});
|
|
|
|
const result = await response.json();
|
|
|
|
if (response.ok) {
|
|
console.log('✅ Succès:', result.message);
|
|
console.log('📋 ID Admin:', result.adminId);
|
|
console.log('🔑 Identifiants: admin/admin');
|
|
} else {
|
|
console.error('❌ Erreur:', result.error);
|
|
}
|
|
} catch (error) {
|
|
console.error('❌ Erreur de connexion:', error.message);
|
|
}
|
|
};
|
|
|
|
resetPassword(); |