Skip to content
This repository was archived by the owner on Jul 28, 2026. It is now read-only.

Commit f8636ae

Browse files
committed
feat: block login for restricted users
1 parent e437965 commit f8636ae

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

routes/admin.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ router.post('/login', async (req, res) => {
3636
}
3737

3838
const user = users[0];
39+
if (user.restricted) {
40+
return res.status(403).json({ error: 'Your account has been restricted. Contact support for assistance.' });
41+
}
3942
if (!user.is_admin) {
4043
return res.status(403).json({ error: 'Access denied. Admin privileges required.' });
4144
}

routes/auth.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ router.post('/login', async (req, res) => {
198198

199199
if (process.env.NODE_ENV !== 'production') console.log('[LOGIN] User found:', { id: user.id, email: user.email });
200200

201+
if (user.restricted) {
202+
return res.status(403).json({ error: 'Your account has been restricted. Contact support for assistance.' });
203+
}
204+
201205
const validPassword = await argon2.verify(user.password_hash, password, { type: argon2.argon2id });
202206
if (!validPassword) {
203207
if (process.env.NODE_ENV !== 'production') console.log('[LOGIN] Password mismatch for user:', user.id);

0 commit comments

Comments
 (0)