update
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
session_start([ 'cookie_lifetime' => 604800 ]);
|
||||
session_regenerate_id();
|
||||
ini_set("session.use_only_cookies", "true");
|
||||
ini_set("session.use_trans_sid", "false");
|
||||
|
||||
if (!isset($APP_CODE)) {
|
||||
$APP_CODE = "ax4";
|
||||
$APP_ROOT = "/";
|
||||
@@ -141,10 +146,12 @@ if (!isset($APP_CODE)) {
|
||||
<img class="logo" loading="lazy" src="/static/<?php echo $APP_ICON ?? "logo.png"; ?>" />
|
||||
<span><?php echo $APP_NAME ?? "Axia<sup>4</sup>"; ?></span>
|
||||
</a>
|
||||
<a href="/lazo.php" class="brand">
|
||||
<img class="logo" title="Nuestra solidaridad con las víctimas y familiares del grave accidente de Adamuz"
|
||||
alt="Nuestra solidaridad con las víctimas y familiares del grave accidente de Adamuz" src="/static/lazo_negro.png" />
|
||||
</a>
|
||||
<?php if ($APP_CODE == "ax4") { ?>
|
||||
<a href="/lazo.php" class="brand" style="padding: 0;">
|
||||
<img style="margin: 0;" class="logo" title="Nuestra solidaridad con las víctimas y familiares del grave accidente de Adamuz"
|
||||
alt="Nuestra solidaridad con las víctimas y familiares del grave accidente de Adamuz" src="/static/lazo_negro.png" />
|
||||
</a>
|
||||
<?php } ?>
|
||||
<input id="bmenub" type="checkbox" class="show" />
|
||||
<label for="bmenub" class="burger button">menú</label>
|
||||
<div class="menu">
|
||||
|
||||
@@ -4,12 +4,14 @@ if ($_GET["reload_user"] == "1") {
|
||||
$user = $_SESSION['auth_user'];
|
||||
$userdata = json_decode(file_get_contents("/DATA/Usuarios/$user.json"), true);
|
||||
$_SESSION['auth_data'] = $userdata;
|
||||
header("Location: /");
|
||||
$redir = $_GET["redir"] ?? "/";
|
||||
header("Location: $redir");
|
||||
die();
|
||||
}
|
||||
if ($_GET["logout"] == "1") {
|
||||
session_destroy();
|
||||
header("Location: /_login.php");
|
||||
$redir = $_GET["redir"] ?? "/";
|
||||
header("Location: $redir");
|
||||
die();
|
||||
}
|
||||
if (isset($_POST["user"])) {
|
||||
@@ -26,7 +28,8 @@ if (isset($_POST["user"])) {
|
||||
$_SESSION['auth_user'] = $user;
|
||||
$_SESSION['auth_data'] = $userdata;
|
||||
$_SESSION['auth_ok'] = true;
|
||||
header("Location: /");
|
||||
$redir = $_GET["redir"] ?? "/";
|
||||
header("Location: $redir");
|
||||
die();
|
||||
} else {
|
||||
$_GET["_result"] = "La contraseña no es correcta.";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
$APP_CODE = "account";
|
||||
$APP_NAME = "Cuenta y identidad";
|
||||
$APP_TITLE = "Cuenta y identidad";
|
||||
$APP_NAME = "Mi Cuenta";
|
||||
$APP_TITLE = "Mi Cuenta";
|
||||
$AUTH_NOPERMS = true;
|
||||
require_once __DIR__ . "/../../_incl/auth_redir.php";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
$APP_CODE = "account";
|
||||
$APP_NAME = "Cuenta y identidad";
|
||||
$APP_TITLE = "Cuenta y identidad";
|
||||
$APP_NAME = "Mi Cuenta";
|
||||
$APP_TITLE = "Mi Cuenta";
|
||||
require_once __DIR__ . "/../../_incl/pre-body.php";
|
||||
|
||||
@@ -2,15 +2,43 @@
|
||||
require_once "_incl/auth_redir.php";
|
||||
require_once "_incl/pre-body.php";
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Cuenta y identidad</h1>
|
||||
<p>Bienvenido a la sección de gestión de tu cuenta e identidad. Aquí puedes actualizar tu información personal, cambiar tu contraseña y gestionar tus preferencias de seguridad.</p>
|
||||
</div>
|
||||
<div class="card pad" style="text-align: center;">
|
||||
<!--QR Code - Username -->
|
||||
<img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=<?php echo urlencode($_SESSION["auth_user"]); ?>" alt="QR Code de Nombre de Usuario" style="margin: 0 auto;">
|
||||
<h2>¡Hola, <?php echo htmlspecialchars($_SESSION["auth_data"]["display_name"]); ?>!</h2>
|
||||
<span><b>Tu Email:</b> <?php echo htmlspecialchars($_SESSION["auth_data"]["email"]); ?></span>
|
||||
<span><b>Tu Nombre de Usuario:</b> <?php echo htmlspecialchars($_SESSION["auth_user"]); ?></span>
|
||||
<div id="grid">
|
||||
<div class="card pad grid-item" style="text-align: center;">
|
||||
<h2>¡Hola, <?php echo htmlspecialchars($_SESSION["auth_data"]["display_name"]); ?>!</h2>
|
||||
<span><b>Tu Email:</b> <?php echo htmlspecialchars($_SESSION["auth_data"]["email"]); ?></span>
|
||||
<span><b>Tu Nombre de Usuario:</b> <?php echo htmlspecialchars($_SESSION["auth_user"]); ?></span>
|
||||
</div>
|
||||
<div class="card pad grid-item" style="text-align: center;">
|
||||
<b>Código QR</b>
|
||||
<img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=<?php echo urlencode($_SESSION["auth_user"]); ?>" alt="QR Code de Nombre de Usuario" style="margin: 0 auto;">
|
||||
<small>Escanea este código para iniciar sesión. Es como tu contraseña, pero más fácil.</small>
|
||||
</div>
|
||||
</div>
|
||||
<style>
|
||||
.grid-item {
|
||||
margin-bottom: 10px !important;
|
||||
padding: 15px;
|
||||
width: 300px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.grid-item img {
|
||||
margin: 0 auto;
|
||||
height: 150px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var msnry = new Masonry('#grid', {
|
||||
"columnWidth": 300,
|
||||
"itemSelector": ".grid-item",
|
||||
"gutter": 10,
|
||||
"transitionDuration": 0
|
||||
});
|
||||
setTimeout(() => {
|
||||
msnry.layout()
|
||||
}, 250)
|
||||
setInterval(() => {
|
||||
msnry.layout()
|
||||
}, 1000);
|
||||
</script>
|
||||
<?php require_once "_incl/post-body.php"; ?>
|
||||
68
public_html/account/register.php
Normal file
68
public_html/account/register.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
require_once "_incl/pre-body.php";
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
// Handle form submission
|
||||
$invitations = json_decode(file_get_contents("/DATA/Invitaciones_de_usuarios.json"), true);
|
||||
$invi_code = strtoupper($_POST['invitation_code'] ?? '');
|
||||
if (!isset($invitations[$invi_code])) {
|
||||
header("Location: /?_resultcolor=red&_result=" . urlencode("Código de invitación no válido."));
|
||||
exit;
|
||||
}
|
||||
$userdata = [
|
||||
'display_name' => $_POST['display_name'],
|
||||
'email' => $_POST['email'],
|
||||
'password_hash' => password_hash($_POST['password'], PASSWORD_DEFAULT),
|
||||
'_meta_signup' => [
|
||||
'invitation_code' => $invi_code
|
||||
],
|
||||
'permissions' => []
|
||||
];
|
||||
if ($invitations[$invi_code]["active"] != true) {
|
||||
header("Location: /?_resultcolor=red&_result=" . urlencode("Código de invitación no válido."));
|
||||
exit;
|
||||
}
|
||||
$username = $_POST['username'];
|
||||
if (file_exists("/DATA/Usuarios/$username.json")) {
|
||||
header("Location: /?_resultcolor=red&_result=" . urlencode("El nombre de usuario ya existe. Por favor, elige otro."));
|
||||
exit;
|
||||
}
|
||||
file_put_contents("/DATA/Usuarios/$username.json", json_encode($userdata, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
// Deactivate invitation code if it's single-use
|
||||
if ($invitations[$invi_code]["single_use"] === true) {
|
||||
$invitations[$invi_code]["active"] = false;
|
||||
file_put_contents("/DATA/Invitaciones_de_usuarios.json", json_encode($invitations, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
|
||||
}
|
||||
header("Location: /?_result=" . urlencode("Cuenta creada correctamente. Ya puedes iniciar sesión."));
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>¡Crea una cuenta!</h1>
|
||||
<form method="post">
|
||||
<fieldset class="card pad" style="border: 2px solid black; border-radius: 6.5px; max-width: 500px;">
|
||||
<label>
|
||||
<b>Codigo de invitación:</b>
|
||||
<input type="text" name="invitation_code" required />
|
||||
<small>Codigo de invitación proporcionado por un administrador.<br>Formato: 123456-ABCDEF</small>
|
||||
</label>
|
||||
<label>
|
||||
<b>Usuario:</b>
|
||||
<input type="text" name="username" required />
|
||||
</label>
|
||||
<label>
|
||||
<b>Contraseña:</b>
|
||||
<input type="password" name="password" required />
|
||||
</label>
|
||||
<label>
|
||||
<b>Nombre:</b>
|
||||
<input type="text" name="display_name" required />
|
||||
</label>
|
||||
<label>
|
||||
<b>Correo electronico:</b>
|
||||
<input type="email" name="email" required />
|
||||
</label>
|
||||
<button type="submit">Crear cuenta</button>
|
||||
<br><br>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
@@ -13,7 +13,23 @@
|
||||
<img src="/static/logo-entreaulas.png" alt="Logo EntreAulas">
|
||||
<b>EntreAulas</b>
|
||||
<span>Gestión de aularios conectados.</span>
|
||||
<a href="/entreaulas/" class="button">Tengo cuenta</a>
|
||||
<?php if ($_SESSION["auth_ok"] && in_array('entreaulas:access', $_SESSION["auth_data"]["permissions"] ?? [])) { ?>
|
||||
<a href="/entreaulas/" class="button">Acceder</a>
|
||||
<?php } else { ?>
|
||||
<hr>
|
||||
<small>No tienes permiso para acceder</small>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="card grid-item">
|
||||
<img src="/static/logo-account.png" alt="Logo Account">
|
||||
<b>Mi Cuenta</b>
|
||||
<span>Acceso a la plataforma y pagos.</span>
|
||||
<?php if ($_SESSION["auth_ok"]) { ?>
|
||||
<a href="/account/" class="button">Ir a mi cuenta</a>
|
||||
<?php } else { ?>
|
||||
<a href="/_login.php?redir=/account/" class="button">Iniciar sesión</a>
|
||||
<a href="/account/register.php" class="button">Crear cuenta</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="card grid-item" style="opacity: 0.5;">
|
||||
<img src="/static/logo-oscar.png" alt="Logo OSCAR">
|
||||
@@ -35,11 +51,6 @@
|
||||
<b>Comunicaciones</b>
|
||||
<span>Correos electrónicos y mensajería.</span>
|
||||
</div>
|
||||
<div class="card grid-item" style="opacity: 0.5;">
|
||||
<img src="/static/logo-account.png" alt="Logo Account">
|
||||
<b>Cuenta y identidad</b>
|
||||
<span>Acceso a la plataforma y pagos.</span>
|
||||
</div>
|
||||
<div class="card grid-item" style="opacity: 0.5;">
|
||||
<img src="/static/logo-malla.png" alt="Logo Malla">
|
||||
<b>Malla Meshtastic</b>
|
||||
@@ -69,8 +80,13 @@
|
||||
<div class="card grid-item">
|
||||
<img src="/static/logo-sysadmin.png" alt="Logo SysAdmin">
|
||||
<b>SysAdmin</b>
|
||||
<span>Panel de administración de sistemas.</span>
|
||||
<a href="/sysadmin/" class="button">Acceso privado</a>
|
||||
<span>Configuración de Axia4.</span>
|
||||
<?php if (in_array('sysadmin:access', $_SESSION["auth_data"]["permissions"] ?? [])) { ?>
|
||||
<a href="/sysadmin/" class="button">Acceder</a>
|
||||
<?php } else { ?>
|
||||
<hr>
|
||||
<small>No tienes permiso para acceder</small>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -94,13 +94,14 @@ switch ($_GET["action"]) {
|
||||
<span>
|
||||
Desde esta sección puedes administrar los aularios asociados al centro que estás administrando.
|
||||
</span>
|
||||
<a href="?action=new" class="button">Nuevo Aulario</a>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Icono</th>
|
||||
<th>Nombre</th>
|
||||
<th>Acciones</th>
|
||||
<th>
|
||||
<a href="?action=new" class="button pseudo" style="background: white; color: black;">+ Nuevo</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -230,12 +230,13 @@ switch ($_GET["action"]) {
|
||||
<span>
|
||||
Desde esta sección puedes administrar los centros asociados al sistema.
|
||||
</span>
|
||||
<a href="?action=new" class="button">Nuevo Centro</a>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nombre</th>
|
||||
<th>Acciones</th>
|
||||
<th>
|
||||
<a href="?action=new" class="button pseudo" style="background: white; color: black;">+ Nuevo</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@@ -8,26 +8,19 @@ require_once "_incl/pre-body.php"; ?>
|
||||
<div id="grid">
|
||||
<div class="card grid-item">
|
||||
<img src="/static/logo-entreaulas.png" alt="Logo EntreAulas">
|
||||
<b>Gestión de Centros</b>
|
||||
<span>Administra los centros del sistema EntreAulas.</span>
|
||||
<b>EntreAulas</b>
|
||||
<a href="/sysadmin/centros.php" class="button">Gestionar Centros</a>
|
||||
</div>
|
||||
<div class="card grid-item">
|
||||
<img src="/static/logo-entreaulas.png" alt="Logo EntreAulas">
|
||||
<b>Gestión de Aularios</b>
|
||||
<span>Administra los aularios dentro de los centros.</span>
|
||||
<a href="/sysadmin/aularios.php" class="button">Gestionar Aularios</a>
|
||||
</div>
|
||||
<div class="card grid-item">
|
||||
<img src="/static/logo-account.png" alt="Logo Cuentas y Identidad">
|
||||
<b>Gestión de Usuarios</b>
|
||||
<span>Administra los usuarios del sistema.</span>
|
||||
<img src="/static/logo-account.png" alt="Logo Mi Cuenta">
|
||||
<b>Mi Cuenta</b>
|
||||
<a href="/sysadmin/users.php" class="button">Gestionar Usuarios</a>
|
||||
<a href="/sysadmin/invitations.php" class="button">Gestionar Invitaciones</a>
|
||||
</div>
|
||||
<div class="card grid-item">
|
||||
<img src="/static/logo-club.png" alt="Logo Club">
|
||||
<b>Generar miniaturas</b>
|
||||
<span>Genera miniaturas para las imágenes del club.</span>
|
||||
<b>La web del Club</b>
|
||||
<a href="/sysadmin/club_mkthumb.php" class="button">Generar Miniaturas</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
93
public_html/sysadmin/invitations.php
Normal file
93
public_html/sysadmin/invitations.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
require_once "_incl/auth_redir.php";
|
||||
|
||||
switch ($_GET['form']) {
|
||||
case "create":
|
||||
// Handle creation logic here
|
||||
$invitations = json_decode(file_get_contents("/DATA/Invitaciones_de_usuarios.json"), true) ?? [];
|
||||
$invitation_code = strtoupper($_POST['invitation_code'] ?? '');
|
||||
$single_use = isset($_POST['single_use']) ? true : false;
|
||||
if (isset($invitations[$invitation_code])) {
|
||||
header("Location: /sysadmin/invitations.php?action=new&_resultcolor=red&_result=" . urlencode("El código de invitación ya existe."));
|
||||
exit;
|
||||
}
|
||||
$invitations[$invitation_code] = [
|
||||
"active" => true,
|
||||
"single_use" => $single_use
|
||||
];
|
||||
file_put_contents("/DATA/Invitaciones_de_usuarios.json", json_encode($invitations, JSON_PRETTY_PRINT));
|
||||
header("Location: /sysadmin/invitations.php?_result=" . urlencode("Código $invitation_code creado correctamente."));
|
||||
exit;
|
||||
break;
|
||||
case "delete":
|
||||
// Handle deletion logic here
|
||||
$invitations = json_decode(file_get_contents("/DATA/Invitaciones_de_usuarios.json"), true) ?? [];
|
||||
$invitation_code = strtoupper($_POST['invitation_code'] ?? '');
|
||||
if (isset($invitations[$invitation_code])) {
|
||||
unset($invitations[$invitation_code]);
|
||||
file_put_contents("/DATA/Invitaciones_de_usuarios.json", json_encode($invitations, JSON_PRETTY_PRINT));
|
||||
}
|
||||
header("Location: /sysadmin/invitations.php?_result=" . urlencode("Codigo $invitation_code borrado"));
|
||||
exit;
|
||||
break;
|
||||
}
|
||||
|
||||
require_once "_incl/pre-body.php";
|
||||
switch ($_GET['action']) {
|
||||
case "new":
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Nueva invitación de usuario</h1>
|
||||
<form method="post" action="?form=create">
|
||||
<fieldset class="card pad" style="border: 2px solid black; border-radius: 6.5px; max-width: 500px;">
|
||||
<label>
|
||||
<b>Código de invitación:</b>
|
||||
<input type="text" name="invitation_code" required />
|
||||
<small>Formato: 123456-ABCDEF</small>
|
||||
</label>
|
||||
<label>
|
||||
<input type="checkbox" name="single_use" />
|
||||
<span class="checkable">Uso único</span>
|
||||
</label>
|
||||
<button type="submit">Crear invitación</button>
|
||||
<br><br>
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
default:
|
||||
case "index":
|
||||
?>
|
||||
<div class="card pad">
|
||||
<h1>Invitaciones de usuarios</h1>
|
||||
<span>Desde aquí puedes gestionar las invitaciones de usuarios.</span>
|
||||
<table>
|
||||
<thead>
|
||||
<th>Codigo de invitación</th>
|
||||
<th>
|
||||
<a href="?action=new" class="button pseudo" style="background: white; color: black;">+ Nuevo</a>
|
||||
</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$invitations = json_decode(file_get_contents("/DATA/Invitaciones_de_usuarios.json"), true);
|
||||
foreach ($invitations as $inv_key => $inv_data) {
|
||||
echo "<tr>";
|
||||
echo "<td>" . htmlspecialchars($inv_key) . "</td>";
|
||||
echo "<td>";
|
||||
echo '<form method="post" action="?form=delete" style="display:inline;">';
|
||||
echo '<input type="hidden" name="invitation_code" value="' . htmlspecialchars($inv_key) . '"/>';
|
||||
echo '<button type="submit" class="button danger" onclick="return confirm(\'¿Estás seguro de que deseas eliminar esta invitación?\');">Eliminar</button>';
|
||||
echo '</form>';
|
||||
echo "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
require_once "_incl/post-body.php";
|
||||
@@ -123,14 +123,15 @@ switch ($_GET['action'] ?? '') {
|
||||
<div class="card pad">
|
||||
<h1>Gestión de Usuarios</h1>
|
||||
<p>Desde esta sección puedes gestionar los usuarios del sistema. Puedes agregar, editar o eliminar usuarios según sea necesario.</p>
|
||||
<a href="?action=add" class="button">Agregar Nuevo Usuario</a>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Usuario</th>
|
||||
<th>Nombre</th>
|
||||
<th>Correo</th>
|
||||
<th>Acciones</th>
|
||||
<th>
|
||||
<a href="?action=add" class="button pseudo" style="background: white; color: black;">+ Nuevo</a>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user