Files
LogiFlow/reset-admin.js
T
michaelschal a6efc91d14 Add emergency admin password reset and improve default admin setup
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
2025-08-11 15:53:01 +00:00

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();