🚀 Auto-deploy: GPI atualizado em 10/08/2026 00:57:32
This commit is contained in:
@@ -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.' });
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user