Add multi-user auth: nafih and vivek accounts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-23 16:41:43 +05:30
parent ed13991515
commit ba63c1ba1a
2 changed files with 6 additions and 3 deletions

View File

@@ -19,8 +19,10 @@ export const config = {
}, },
port: parseInt(process.env.PORT ?? '3002', 10), port: parseInt(process.env.PORT ?? '3002', 10),
auth: { auth: {
email: process.env.AUTH_EMAIL ?? 'admin@eventifyplus.com', users: [
password: process.env.AUTH_PASSWORD ?? 'eventify2026', { email: 'nafih@bshtechnologies.in', password: 'Nafih@2020' },
{ email: 'vivek@bshtechnologies.in', password: 'q1w2e3r4' },
],
jwtSecret: process.env.JWT_SECRET ?? 'eventify-server-monitor-secret-key-change-in-production', jwtSecret: process.env.JWT_SECRET ?? 'eventify-server-monitor-secret-key-change-in-production',
}, },
} as const; } as const;

View File

@@ -13,7 +13,8 @@ authRouter.post('/login', (req, res) => {
return; return;
} }
if (email === config.auth.email && password === config.auth.password) { const user = config.auth.users.find(u => u.email === email && u.password === password);
if (user) {
const token = jwt.sign( const token = jwt.sign(
{ email, role: 'admin' }, { email, role: 'admin' },
config.auth.jwtSecret, config.auth.jwtSecret,