feat(reception,udeci): v3.8.48 - forced scanner focus, spanish keyboard gun normalization, reception default dashboard, and udeci commission listings
This commit is contained in:
+3
-3
@@ -86,9 +86,9 @@ const env = nunjucks.configure(path.join(__dirname, '../views'), {
|
||||
});
|
||||
|
||||
// Versiones institucionales del sistema
|
||||
const APP_VERSION = '3.8.47';
|
||||
const FRONTEND_VERSION = '3.8.47';
|
||||
const BACKEND_VERSION = '3.8.47';
|
||||
const APP_VERSION = '3.8.48';
|
||||
const FRONTEND_VERSION = '3.8.48';
|
||||
const BACKEND_VERSION = '3.8.48';
|
||||
|
||||
env.addGlobal('app_version', APP_VERSION);
|
||||
env.addGlobal('frontend_version', FRONTEND_VERSION);
|
||||
|
||||
@@ -64,7 +64,9 @@ router.post('/login', async (req, res) => {
|
||||
sameSite: 'lax',
|
||||
maxAge: 24 * 60 * 60 * 1000 // 1 día
|
||||
});
|
||||
return res.redirect('/dashboard');
|
||||
const userRole = (response.data.user?.role || '').toLowerCase();
|
||||
const target = (userRole === 'recepcion' || userRole === 'reception') ? '/reception/scanner' : '/dashboard';
|
||||
return res.redirect(target);
|
||||
}
|
||||
|
||||
return res.redirect('/auth/login?error=' + encodeURIComponent('Autenticación fallida'));
|
||||
@@ -89,7 +91,9 @@ router.post('/moodle', async (req, res) => {
|
||||
sameSite: 'lax',
|
||||
maxAge: 24 * 60 * 60 * 1000
|
||||
});
|
||||
return res.redirect('/dashboard');
|
||||
const userRole = (response.data.user?.role || '').toLowerCase();
|
||||
const target = (userRole === 'recepcion' || userRole === 'reception') ? '/reception/scanner' : '/dashboard';
|
||||
return res.redirect(target);
|
||||
}
|
||||
res.redirect('/auth/login?error=moodle_auth_failed');
|
||||
} catch (error) {
|
||||
@@ -112,7 +116,9 @@ router.post('/google', async (req, res) => {
|
||||
sameSite: 'lax',
|
||||
maxAge: 24 * 60 * 60 * 1000
|
||||
});
|
||||
return res.json({ success: true, redirect: '/dashboard' });
|
||||
const userRole = (response.data.user?.role || '').toLowerCase();
|
||||
const target = (userRole === 'recepcion' || userRole === 'reception') ? '/reception/scanner' : '/dashboard';
|
||||
return res.json({ success: true, redirect: target });
|
||||
}
|
||||
return res.status(401).json({ success: false, message: 'Fallo al autenticar con Google.' });
|
||||
} catch (error) {
|
||||
|
||||
@@ -36,7 +36,7 @@ router.get('/token', async (req, res) => {
|
||||
} catch (err) {
|
||||
console.warn('API error fetching QR token:', err.message);
|
||||
// Fallback token if reception endpoint fails or is offline
|
||||
const fallbackToken = `UNICABA:USR:${req.user?.id || 0}:DNI:${req.user?.document_number || req.user?.email || 'N/A'}`;
|
||||
const fallbackToken = `UNICABA:USR:${req.user?.id || 0}:DNI:${req.user?.document_number || req.user?.id || req.user?.email || 'N/A'}`;
|
||||
return res.json({
|
||||
status: 'fallback',
|
||||
qr_token: fallbackToken,
|
||||
|
||||
@@ -6,6 +6,9 @@ router.use(requireAuth);
|
||||
|
||||
router.get('/', async (req, res) => {
|
||||
const actual_role = (req.user?.role || 'admin').toLowerCase();
|
||||
if (actual_role === 'recepcion' || actual_role === 'reception') {
|
||||
return res.redirect('/reception/scanner');
|
||||
}
|
||||
const roleParam = (req.query.role || req.query.view_as || '').toLowerCase().trim();
|
||||
const role = (['admin', 'bedelia', 'docente', 'alumno'].includes(roleParam) ? roleParam : actual_role) || 'admin';
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@ const express = require('express');
|
||||
const router = express.Router();
|
||||
|
||||
router.get('/', (req, res) => {
|
||||
// Redirigimos por defecto a dashboard o login
|
||||
const userRole = (req.user?.role || '').toLowerCase();
|
||||
if (userRole === 'recepcion' || userRole === 'reception') {
|
||||
return res.redirect('/reception/scanner');
|
||||
}
|
||||
res.redirect('/dashboard');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user