carritoIA/templates/perfil.html

132 lines
5.7 KiB
HTML

<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Mi perfil — CarritoIA</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
<style>
.perfil-wrap { max-width: 560px; margin: 0 auto; }
.perfil-section {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: .7rem;
padding: 1.25rem 1.5rem;
margin-bottom: 1.25rem;
}
.perfil-section h2 {
margin: 0 0 1rem;
font-size: 1rem;
border-bottom: 1px solid var(--border);
padding-bottom: .6rem;
}
label { display: block; font-size: .82rem; color: var(--text-muted); margin-bottom: .25rem; margin-top: .75rem; }
label:first-of-type { margin-top: 0; }
input[type=text], input[type=password], input[type=number], select {
width: 100%; padding: .55rem .75rem;
background: var(--bg-input); border: 1px solid var(--border);
border-radius: .45rem; color: var(--text); font-size: .9rem;
}
input:focus, select:focus { outline: none; border-color: var(--primary); }
.form-row { display: flex; gap: .75rem; }
.form-row > * { flex: 1; }
.check-row { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; font-size: .88rem; }
.check-row input[type=checkbox] { width: auto; }
</style>
</head>
<body>
<div style="display:flex; align-items:center; justify-content:space-between; margin-bottom:1.25rem;">
<h1 style="margin:0;">Mi perfil</h1>
<div style="display:flex; align-items:center; gap:.75rem;">
<a href="/" class="btn btn-secondary btn-sm">← Inicio</a>
<span style="font-size:.85rem; color:var(--text-muted);">{{ nombre }}</span>
<a href="/logout" class="btn btn-secondary btn-sm">Salir</a>
</div>
</div>
<div class="perfil-wrap">
{% if error %}
<div class="alert" style="margin-bottom:1rem;">{{ error }}</div>
{% endif %}
{% if ok %}
<div class="alert alert-ok" style="margin-bottom:1rem;">✅ {{ ok }}</div>
{% endif %}
<!-- Nombre -->
<div class="perfil-section">
<h2>Datos personales</h2>
<form method="post">
<input type="hidden" name="accion" value="nombre">
<label for="nombre">Nombre visible</label>
<input id="nombre" name="nombre" type="text" value="{{ nombre }}" required>
<button type="submit" class="btn btn-primary btn-sm" style="margin-top:.85rem;">Guardar nombre</button>
</form>
</div>
<!-- Contraseña -->
<div class="perfil-section">
<h2>Cambiar contraseña</h2>
<form method="post">
<input type="hidden" name="accion" value="password">
<label for="pwd_actual">Contraseña actual</label>
<input id="pwd_actual" name="pwd_actual" type="password" autocomplete="current-password" required>
<label for="pwd_nueva">Nueva contraseña</label>
<input id="pwd_nueva" name="pwd_nueva" type="password" autocomplete="new-password" placeholder="min. 6 caracteres" required>
<label for="pwd_nueva2">Repite la nueva contraseña</label>
<input id="pwd_nueva2" name="pwd_nueva2" type="password" autocomplete="new-password" placeholder="••••••••" required>
<button type="submit" class="btn btn-primary btn-sm" style="margin-top:.85rem;">Cambiar contraseña</button>
</form>
</div>
<!-- Email / IMAP -->
<div class="perfil-section">
<h2>📧 Importación automática de tickets</h2>
<p style="font-size:.82rem; color:var(--text-muted); margin:0 0 1rem;">
Configura tu cuenta de correo para que la app descargue automáticamente
los tickets PDF de Mercadona. Reenvía o configura
<strong>noreply@mercadona.es</strong> como remitente.
</p>
<form method="post">
<input type="hidden" name="accion" value="email">
<div class="form-row">
<div>
<label for="imap_host">Servidor IMAP</label>
<input id="imap_host" name="imap_host" type="text"
placeholder="imap.gmail.com"
value="{{ email_cfg.get('imap_host', '') }}">
</div>
<div style="max-width:100px;">
<label for="imap_port">Puerto</label>
<input id="imap_port" name="imap_port" type="number"
value="{{ email_cfg.get('imap_port', '993') }}">
</div>
</div>
<label for="correo">Correo electrónico</label>
<input id="correo" name="correo" type="text"
placeholder="tu@correo.com"
value="{{ email_cfg.get('correo', '') }}" autocomplete="off">
<label for="email_pwd">Contraseña del correo</label>
<input id="email_pwd" name="email_pwd" type="password"
placeholder="contraseña o clave de aplicación"
value="{{ email_cfg.get('password', '') }}" autocomplete="off">
<label for="remitente">Remitente de tickets (no cambiar normalmente)</label>
<input id="remitente" name="remitente" type="text"
value="{{ email_cfg.get('remitente', 'noreply@mercadona.es') }}">
<div class="check-row">
<input type="checkbox" id="ssl_verify" name="ssl_verify"
value="false"
{% if email_cfg.get('ssl_verify', 'true') == 'false' %}checked{% endif %}>
<label for="ssl_verify" style="margin:0; color:var(--text);">
Desactivar verificación SSL (útil con servidores locales)
</label>
</div>
<button type="submit" class="btn btn-primary btn-sm" style="margin-top:.85rem;">Guardar configuración de email</button>
</form>
</div>
</div><!-- /perfil-wrap -->
</body>
</html>