🚀 Auto-deploy: GPI atualizado em 10/08/2026 00:57:32

This commit is contained in:
2026-08-10 00:57:32 +00:00
parent d3ed824d81
commit 0a8bd86218
28 changed files with 1605 additions and 818 deletions
+27
View File
@@ -191,4 +191,31 @@ export const deleteUser = async (req: Request, res: Response) => {
console.error('Error deleting user:', error);
res.json({ message: 'Membro removido com sucesso.' });
}
};
export const login = async (req: Request, res: Response) => {
try {
const { password } = req.body;
// In a real app, this should check against a hashed DB value or Logto.
// For now, moving the hardcoded password to the backend is safer than frontend.
const adminPassword = process.env.ADMIN_PASSWORD || '@@Gi05Br;;';
if (password === adminPassword) {
// Success - return a token
return res.json({
success: true,
token: 'gpi-admin-token',
user: {
id: 'admin-user',
role: 'admin',
name: 'Administrador'
}
});
}
return res.status(401).json({ success: false, error: 'Senha incorreta.' });
} catch (error) {
console.error('Login error:', error);
res.status(500).json({ success: false, error: 'Erro interno.' });
}
};