Fix jwt-token
This commit is contained in:
18
approve_devices.js
Normal file
18
approve_devices.js
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
const axios = require('axios');
|
||||||
|
|
||||||
|
// Simple script to approve all pending devices for testing
|
||||||
|
async function approveAllDevices() {
|
||||||
|
try {
|
||||||
|
// First, we need to get an auth token - for now let's use the direct database approach
|
||||||
|
console.log('This script would need authentication. Instead, run these SQL commands:');
|
||||||
|
console.log('');
|
||||||
|
console.log('UPDATE devices SET is_approved = true, is_active = true WHERE is_approved = false;');
|
||||||
|
console.log('');
|
||||||
|
console.log('Or use the admin interface to approve devices individually.');
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error approving devices:', error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
approveAllDevices();
|
||||||
@@ -186,6 +186,8 @@ async function handleHeartbeat(req, res) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Device exists and is approved - continue with heartbeat processing
|
||||||
|
|
||||||
// Update device's last heartbeat
|
// Update device's last heartbeat
|
||||||
await device.update({ last_heartbeat: new Date() });
|
await device.update({ last_heartbeat: new Date() });
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user