conversations: fix apostrofe en onclick + quitar bypass auth dev
This commit is contained in:
+5
-14
@@ -1,23 +1,11 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
// MODO DESARROLLO: bypass auth temporalmente
|
||||
// TODO: Quitar esto en producción
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
// Crear sesión temporal de prueba
|
||||
$_SESSION['user_id'] = 1;
|
||||
$_SESSION['username'] = 'admin';
|
||||
$_SESSION['admin_logged_in'] = true; // Requerido para requireAuthentication()
|
||||
error_log('⚠️ SESIÓN DE DESARROLLO CREADA - Quitar en producción');
|
||||
}
|
||||
|
||||
// Verificar autenticación (comentado para desarrollo)
|
||||
/*
|
||||
// Verificar autenticación
|
||||
if (!isset($_SESSION['user_id'])) {
|
||||
header('Location: login.php');
|
||||
exit;
|
||||
}
|
||||
*/
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
@@ -2774,8 +2762,11 @@ if (!isset($_SESSION['user_id'])) {
|
||||
const unreadClass = (conv.unread_count && conv.unread_count > 0 && !isActive) ? 'unread' : '';
|
||||
const attentionClass = conv.advisor_requested ? ' attention' : '';
|
||||
|
||||
// Escapar apóstrofes/comillas en nombre y teléfono para no romper el onclick
|
||||
const safeName = (conv.name || '').replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
||||
const safePhone = (conv.phone_number || '').replace(/\\/g, '\\\\').replace(/'/g, "\\'");
|
||||
return `
|
||||
<div class="conversation-item ${isActive} ${unreadClass}${attentionClass}" data-user-id="${conv.user_id}" onclick="chat.openConversation(${conv.user_id}, '${conv.name}', '${conv.phone_number}')">
|
||||
<div class="conversation-item ${isActive} ${unreadClass}${attentionClass}" data-user-id="${conv.user_id}" onclick="chat.openConversation(${conv.user_id}, '${safeName}', '${safePhone}')">
|
||||
<div class="conversation-avatar-wrapper">
|
||||
${avatar}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user