feat: implement internal and user security middlewares and refactor route structures to support view and API separation

This commit is contained in:
Giuseppe Raffa
2026-04-04 19:11:29 +02:00
parent 0f511c2cf9
commit 3cd5a84cc1
8 changed files with 83 additions and 42 deletions

View File

@@ -2,22 +2,9 @@ const router = require('express').Router();
const auth = require('../core/auth.core');
const jwt = require('../tools/jwt');
const version = process.env.VERSION;
const vBuild = process.env.VERSION_BUILD;
const vState = process.env.VERSION_STATE;
const CONSOLE_URL = process.env.CONSOLE_URL || 'http://localhost:3004';
const COOKIE_DOMAIN = process.env.COOKIE_DOMAIN || undefined;
router.get('/health', (req, res) => {
res.json({
status: 'ok',
service: 'auth',
version: version,
build_number: vBuild,
version_state: vState
});
});
router.post('/register', async (req, res) => {
const { username, password } = req.body;
@@ -36,10 +23,7 @@ router.post('/register', async (req, res) => {
}
});
router.get('/login', (req, res) => {
const redirect = req.query.redirect || '';
res.render('loginpage', { error: null, redirect });
});
router.post('/login', async (req, res) => {
const { username, password, redirect } = req.body;