Skip to content

Commit 5c8bc70

Browse files
committed
fix: use pteroId instead of userId for server ownership check in power route
1 parent a13c349 commit 5c8bc70

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

routes/servers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,9 +544,9 @@ router.post('/power/:identifier', authenticateToken, powerLimiter, async (req, r
544544
try {
545545
const { identifier } = req.params;
546546
const { signal } = req.body;
547-
const userId = req.user.userId;
547+
const pteroId = req.user.pteroId;
548548

549-
if (!await verifyServerOwnership(userId, identifier)) {
549+
if (!await verifyServerOwnership(pteroId, identifier)) {
550550
return res.status(403).json({ error: 'You do not own this server' });
551551
}
552552

@@ -555,7 +555,7 @@ router.post('/power/:identifier', authenticateToken, powerLimiter, async (req, r
555555
return res.status(400).json({ error: 'Invalid power signal. Valid signals: start, stop, restart, kill' });
556556
}
557557

558-
const users = await query('SELECT ptero_client_api_key FROM users WHERE id = ?', [userId]);
558+
const users = await query('SELECT ptero_client_api_key FROM users WHERE id = ?', [req.user.userId]);
559559
if (!users[0]?.ptero_client_api_key) {
560560
return res.status(400).json({ error: 'No Pyrodactyl API key configured' });
561561
}

0 commit comments

Comments
 (0)