Fedgo29 commited on
Commit ·
f7690ab
1
Parent(s): d7f2456
Adding changes by FedgoX
Browse filesFiles changed (32)
- __pycache__/app.cpython-313.pyc
- app.py+11-2
- app/models/diploma.py+2
- app/routes/auth.py+1-1
- app/routes/diploma.py+37
- app/templates/admin_pending.html+10
- app/templates/diploma_list.htmlAdded+68
- app/templates/issue.html+10
- app/templates/issue_success.html+15
- app/templates/login.html+9
- app/templates/register.html+9
- app/templates/verify.html+165-125
- app_pkg/models/__pycache__/diploma.cpython-313.pyc
- app_pkg/models/diploma.py+2
- app_pkg/routes/__pycache__/auth.cpython-313.pyc
- app_pkg/routes/__pycache__/diploma.cpython-313.pyc
- app_pkg/routes/auth.py+1-1
- app_pkg/routes/diploma.py+30
- app_pkg/static/pdfs/002a47521e8645f7b7ffa388cc39c4f4.pdfAdded
- app_pkg/static/pdfs/1012185aa1124c829477b6a548c687e0.pdfAdded
- app_pkg/static/pdfs/6dd3f794fdb645b4a0edb1d6aff30620.pdfAdded
- app_pkg/static/qrs/002a47521e8645f7b7ffa388cc39c4f4.pngAdded
- app_pkg/static/qrs/1012185aa1124c829477b6a548c687e0.pngAdded
- app_pkg/static/qrs/6dd3f794fdb645b4a0edb1d6aff30620.pngAdded
- app_pkg/templates/admin_pending.html+10
- app_pkg/templates/diploma_list.htmlAdded+68
- app_pkg/templates/issue.html+10
- app_pkg/templates/issue_success.html+15
- app_pkg/templates/login.html+9
- app_pkg/templates/verify.html+11
- instance/data.db
- scripts/add_qr_column.pyAdded+69
1123451 unmodified line7891011121314151617181910 unmodified lines30313226333435363738from flask import Flask, render_templatefrom flask import Flask, render_template, redirect, url_forfrom jinja2 import ChoiceLoader, FileSystemLoaderfrom flask_login import LoginManagerfrom app_pkg.models import dbfrom app_pkg.routes import register_blueprints1 unmodified line
# Application Factorydef create_app(): # Allow templates to be loaded from both `app/templates` and `app_pkg/templates`. app = Flask(__name__, template_folder="app_pkg/templates", static_folder="app_pkg/static") # Prefer `app/templates` first (developer edits often there), then `app_pkg/templates`. app.jinja_loader = ChoiceLoader([ FileSystemLoader("app/templates"), FileSystemLoader("app_pkg/templates"), ]) app.config.from_object("config.Config")
db.init_app(app)10 unmodified lines
@app.route("/") def index(): return render_template("login.html") # Redirect root to the diplomas list; if user is not logged-in # the `list_diplomas` route is protected and will redirect to login. return redirect(url_for('diploma.list_diplomas'))
register_blueprints(app)
21 unmodified lines222324252621 unmodified lines registration_number = db.Column(db.String(100), primary_key=True) provincial_director = db.Column(db.String(150), nullable=True) graduation_year = db.Column(db.Integer, nullable=True) # Path to generated QR image (relative to static folder), set after QR generation qr_path = db.Column(db.String(255), nullable=True)79 unmodified lines808182838384858679 unmodified lines # browser POST: redirect based on role if getattr(user, "role", "user") == "admin": return redirect(url_for("admin.list_pending")) return redirect(url_for("diploma.create_diploma")) return redirect(url_for("diploma.list_diplomas"))
@auth_bp.route("/logout", methods=["GET", "POST"])101 unmodified lines10210310410510610710810911011111211311411511611711811912012112212312417 unmodified lines142143144145146147148149150151152153154155156157158159160161162163164165166167101 unmodified lines with open(qr_path, "wb") as qr_file: qr.save(qr_file)
# save QR path to the diploma record in DB try: diploma.qr_path = f"/static/qrs/{diploma.hash_code}.png" db.session.add(diploma) db.session.commit() except Exception: db.session.rollback()
# save QR path to the diploma record in DB try: diploma.qr_path = f"/static/qrs/{diploma.hash_code}.png" db.session.add(diploma) db.session.commit() except Exception: # don't fail the whole request if saving the qr_path fails db.session.rollback()
# save uploaded pdf if present if not request.is_json and "pdf" in request.files: pdf = request.files["pdf"]17 unmodified lines }
@diploma_bp.route("/", methods=["GET"])@login_requireddef list_diplomas(): diplomas = Diploma.query.order_by(Diploma.student_name).all() rows = [] for d in diplomas: if d is None: continue rows.append({ "student_name": getattr(d, "student_name", "") or "", "student_id": getattr(d, "student_id", "") or "", "title": getattr(d, "certification_title", "") or "", "graduation_year": getattr(d, "graduation_year", "") or "", "registration_number": getattr(d, "registration_number", "") or "", "hash_code": getattr(d, "hash_code", ""), "qr_path": getattr(d, "qr_path", "") or "", }) return render_template("diploma_list.html", diplomas=rows)
@diploma_bp.route('/view/<hash_code>')def view_diploma(hash_code): diploma = Diploma.query.filter_by(hash_code=hash_code).first()1 unmodified line234567883 unmodified lines92939495969798991001011021031041051061 unmodified line<html lang="es"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Usuarios Pendientes</title>
<style>83 unmodified lines to { opacity: 1; transform: translateY(0); } }
/* Responsive tweaks */ @media (max-width: 700px) { body { padding: 12px; } .top-bar { flex-direction: column; align-items: flex-start; gap:10px; } .card { padding: 12px; } li { flex-direction: column; align-items: flex-start; gap:8px; } .btn { width: 100%; } }
</style></head>
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768<!doctype html><html lang="es"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Lista de Diplomas</title> <style> body { font-family: "Segoe UI", sans-serif; background: #0f172a; color: #e5e7eb; padding: 30px; } .container { max-width: 1000px; margin: 0 auto; } h2 { color: #93c5fd; } .top-actions { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; } a.button { background:#3b82f6; color:#fff; padding:10px 14px; border-radius:8px; text-decoration:none; font-weight:600 } table { width:100%; border-collapse:collapse; margin-top:12px; background:#0b1220; border-radius:8px; overflow:hidden } th, td { padding:10px 12px; text-align:left; border-bottom:1px solid rgba(255,255,255,0.04); } th { background:#071027; color:#93c5fd; font-weight:700 } tr:hover td { background: rgba(255,255,255,0.02) } .action-btn { background:#10b981; color:#fff; padding:6px 10px; border-radius:6px; text-decoration:none; font-weight:700 } /* Responsive tweaks */ @media (max-width: 800px) { .container { padding: 12px; } .top-actions { flex-direction: column; align-items: flex-start; gap:8px; } .top-actions .button { width: 100%; display:block; } table { display: block; overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; } table th, table td { white-space: nowrap; } } </style></head><body><div class="container"> <div class="top-actions"> <h2>Diplomas emitidos</h2> <div> <a class="button" href="/diploma/create">Emitir & Generar QR</a> <a class="button" href="{{ url_for('auth.logout') }}" style="background:#ef4444; margin-left:10px;">Cerrar sesión</a> </div> </div>
<table> <thead> <tr> <th>Nombre del Estudiante</th> <th>Cédula</th> <th>Título</th> <th>Año</th> <th>Número de Registro</th> <th>Acciones</th> </tr> </thead> <tbody> {% for d in diplomas %} <tr> <td>{{ d.student_name }}</td> <td>{{ d.student_id }}</td> <td>{{ d.title }}</td> <td>{{ d.graduation_year }}</td> <td>{{ d.registration_number }}</td> <td> <a class="action-btn" href="/api/verify/{{ d.hash_code }}">Ver datos</a> </td> </tr> {% else %} <tr><td colspan="6">No hay diplomas registrados.</td></tr> {% endfor %} </tbody> </table></div></body></html>1 unmodified line2345678106 unmodified lines1151161171181191201211221231241251261271281291 unmodified line<html lang="es"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Emitir Diploma (Admin)</title> <style> body {106 unmodified lines from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* Responsive tweaks */ @media (max-width: 768px) { body { padding: 18px; } .cert-form { width: 100% !important; max-width: 100%; padding: 1rem; box-sizing: border-box; } .topbar { flex-direction: column; align-items: flex-start; gap: 12px; } h2 { font-size: 20px; } button[type="submit"] { font-size: 15px; } } </style></head>
1 unmodified line2345678125 unmodified lines1341351361371381391401411421431441451461471481491501511521531 unmodified line<html lang="es"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Diploma Creado</title> <style> body {125 unmodified lines from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* Responsive tweaks */ @media (max-width: 900px) { .grid { grid-template-columns: 1fr; width: 100%; padding: 1rem; } .card { padding: 1rem; } img { max-width: 100%; } .button-like { font-size: 15px; } }
@media (max-width: 480px) { body { padding: 12px; } .topbar { padding: 10px; } h2 { font-size: 18px; } } </style></head><body>1 unmodified line234567879 unmodified lines8889909192939495969798991001011 unmodified line<html lang="es"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Login</title> <style> body {79 unmodified lines from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* Responsive tweaks */ @media (max-width: 640px) { body { padding: 18px; align-items: flex-start; height: auto; } form { width: 100% !important; max-width: 420px; margin: 40px auto; padding: 1.25rem; box-sizing: border-box; } h2 { font-size: 20px; } input, button { font-size: 15px; } } </style></head><body>1 unmodified line234567878 unmodified lines878889909192939495969798991001 unmodified line<html lang="es"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Registro</title> <style> body {78 unmodified lines from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* Responsive tweaks */ @media (max-width: 640px) { body { padding: 18px; align-items: flex-start; height: auto; } form { width: 100% !important; max-width: 420px; margin: 40px auto; padding: 1.25rem; box-sizing: border-box; } h2 { font-size: 20px; } input, button { font-size: 15px; } } </style></head><body>12345678914 unmodified lines242526252728293021 unmodified lines52535455565755585960615 unmodified lines6768696770717273747576737778798077818283848586878488899091929394959613 unmodified lines110111112104105113114115116117118119120121122123124125126127128129130131132133134135111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180143144145146147148149150151152153154155156157158159160161162163164165166181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229243244245246247248249250251252253254255256257258259260261262263264265266267268269270271232272<!doctype html><html lang="es">
<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Diploma Verificado</title> <style> body {14 unmodified lines width: 90%; max-width: 600px; padding: 2rem 2.5rem; box-shadow: 0 0 35px rgba(0,0,0,0.45); box-shadow: 0 0 35px rgba(0, 0, 0, 0.45); animation: fadeIn 0.5s ease-out; }
21 unmodified lines
.copy-btn { display: inline-block; margin-top: 25px; margin-left: 12px; background: #10b981; padding: 6px 10px; padding: 12px 18px; color: #fff; border: none; border-radius: 8px;5 unmodified lines
.copy-btn:hover { background: #059669; transform: translateY(-1px); transform: translateY(-2px); }
.toast { position: fixed; right: 20px; bottom: 20px; background: rgba(0,0,0,0.85); background: rgba(0, 0, 0, 0.85); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.4); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); font-weight: 600; z-index: 1100; opacity: 0; transform: translateY(8px); transition: all 220ms ease; } .toast.show { opacity: 1; transform: translateY(0); }
.toast.show { opacity: 1; transform: translateY(0); }
a.download { display: inline-block; margin-top: 25px;13 unmodified lines }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } from { opacity: 0; transform: translateY(20px); }
to { opacity: 1; transform: translateY(0); } }
/* Responsive tweaks */ @media (max-width: 680px) { body { padding: 12px; align-items: flex-start; } .card { width: 100%; max-width: 100%; padding: 1rem; box-sizing: border-box; } h2 { font-size: 20px; } .copy-btn, a.download { padding: 10px 12px; font-size: 14px; } } </style></head>
<body>
<div class="card">
<h2>Diploma verificado ✔️</h2>
<p class="field"><span class="label">Nombre:</span> <span class="value" data-field="student_name">{{ student_name }}</span></p> <p class="field"><span class="label">Cédula:</span> <span class="value" data-field="student_id">{{ student_id }}</span></p> <p class="field"><span class="label">Centro:</span> <span class="value" data-field="center_name">{{ center_name }}</span></p> <p class="field"><span class="label">Nombre del Título Obtenido:</span> <span class="value" data-field="title">{{ title }}</span></p> <p class="field"><span class="label">Año de la Graduación:</span> <span class="value" data-field="graduation_year">{{ graduation_year }}</span></p> <p class="field"><span class="label">Número de registro:</span> <span class="value" data-field="registration_number">{{ registration_number }}</span></p> <p class="field"><span class="label">Director:</span> <span class="value" data-field="director">{{ director }}</span></p> <p class="field"><span class="label">Directora provincial:</span> <span class="value" data-field="provincial_director">{{ provincial_director }}</span></p> <p class="field"><span class="label">Profesor:</span> <span class="value" data-field="professor">{{ professor }}</span></p> <!--<p class="field"><span class="label">ID:</span> <span class="value">{{ diploma_id }}</span></p>-->
<p class="field"><span class="label">Adjunto PDF:</span> <span class="value" data-field="pdf"> {% if pdf_url %} <a class="download" href="{{ pdf_url }}">Ver PDF adjunto</a> {% elif pdf %} {{ pdf }} {% else %} (sin adjunto) {% endif %} </span> </p>
<div style="margin-top:8px; display:flex; gap:10px; align-items:center;"> <a class="download" href="{{ download_url }}">Descargar PDF (seguro)</a> <button class="copy-btn" id="copy-all-btn" type="button" title="Copiar resumen">Copiar resumen</button> <div class="card">
<h2>Diploma verificado ✔️</h2>
<p class="field"><span class="label">Nombre:</span> <span class="value" data-field="student_name">{{ student_name }}</span></p> <p class="field"><span class="label">Cédula:</span> <span class="value" data-field="student_id">{{ student_id }}</span></p> <p class="field"><span class="label">Centro:</span> <span class="value" data-field="center_name">{{ center_name }}</span></p> <p class="field"><span class="label">Nombre del Título Obtenido:</span> <span class="value" data-field="title">{{ title }}</span></p> <p class="field"><span class="label">Año de la Graduación:</span> <span class="value" data-field="graduation_year">{{ graduation_year }}</span></p> <p class="field"><span class="label">Número de registro:</span> <span class="value" data-field="registration_number">{{ registration_number }}</span></p> <p class="field"><span class="label">Director:</span> <span class="value" data-field="director">{{ director }}</span></p> <p class="field"><span class="label">Directora provincial:</span> <span class="value" data-field="provincial_director">{{ provincial_director }}</span></p> <p class="field"><span class="label">Profesor:</span> <span class="value" data-field="professor">{{ professor }}</span></p> <!--<p class="field"><span class="label">ID:</span> <span class="value">{{ diploma_id }}</span></p>-->
{% if pdf_url %} <p class="field"><span class="label">Adjunto PDF:</span> <span class="value" data-field="pdf"> {% if pdf_url %} <a class="download" href="{{ pdf_url }}">Ver PDF adjunto</a> {% elif pdf %} {{ pdf }} {% else %} (sin adjunto) {% endif %} </span> </p> {% endif %}
<div style="margin-top:8px; display:flex; gap:10px; align-items:center;"> <a class="download" href="{{ download_url }}">Descargar PDF (seguro)</a> <button class="copy-btn" id="copy-all-btn" type="button" title="Copiar resumen">Copiar resumen</button> </div>
</div>
</div>
<script> function showTempMessage(btn, msg = 'Copiado!', timeout = 1400) { const old = btn.textContent; btn.textContent = msg; <div style="display:flex; align-items:center; justify-content:space-between; gap:12px;"> <h2 style="margin:0">Diploma verificado ✔️</h2> <button class="copy-btn" id="copy-top-btn" type="button" title="Copiar datos completos">Copiar datos</button> </div> setTimeout(() => btn.textContent = old, timeout); }
async function copyText(text, btn) { try { if (navigator.clipboard && navigator.clipboard.writeText) { await navigator.clipboard.writeText(text); } else { const ta = document.createElement('textarea'); ta.value = text; document.body.appendChild(ta); ta.select(); document.execCommand('copy'); document.body.removeChild(ta); <script> function showTempMessage(btn, msg = 'Copiado!', timeout = 1400) { const old = btn.textContent; btn.textContent = msg; setTimeout(() => btn.textContent = old, timeout); }
async function copyText(text, btn) { const old = btn.textContent; try { if (navigator.clipboard && navigator.clipboard.writeText) { await navigator.clipboard.writeText(text); } else { const ta = document.createElement('textarea'); ta.value = text; ta.setAttribute('readonly', ''); ta.style.position = 'fixed'; ta.style.left = '-9999px'; document.body.appendChild(ta); ta.select(); document.execCommand('copy'); document.body.removeChild(ta); } showTempMessage(btn); } catch (err) { console.error('Copy failed', err); btn.textContent = 'Error'; setTimeout(() => btn.textContent = old, 1400); } }
// Build the summary text from visible data-fields function buildSummary() { const map = [ ['Nombre del Estudiante', 'student_name'], ['Cédula', 'student_id'], ['Centro de Enseñanza Superior', 'center_name'], ['Nombre del Título Obtenido', 'title'], ['Año de la Graduación', 'graduation_year'], ['Número de Registro', 'registration_number'], ['Director del Centro Educativo', 'director'], ['Directora Provincial', 'provincial_director'], ['Profesor', 'professor'], ['Adjunto PDF', 'pdf'] ]; const parts = []; map.forEach(([label, key]) => { const el = document.querySelector(`[data-field='${key}']`); if (el && el.textContent && el.textContent.trim()) parts.push(`${label}: ${el.textContent.trim()}`); }); return parts.join('\n'); }
// show a small toast notification function showToast(text, timeout = 1400) { let t = document.getElementById('copy-toast'); if (!t) { t = document.createElement('div'); t.id = 'copy-toast'; t.className = 'toast'; document.body.appendChild(t); } showTempMessage(btn); } catch (err) { console.error('Copy failed', err); btn.textContent = 'Error'; setTimeout(() => btn.textContent = 'Copiar', 1400); } }
// Build the summary text from visible data-fields function buildSummary() { const map = [ ['Nombre del Estudiante', 'student_name'], ['Cédula', 'student_id'], ['Centro de Enseñanza Superior', 'center_name'], ['Nombre del Título Obtenido', 'title'], ['Año de la Graduación', 'graduation_year'], ['Número de Registro', 'registration_number'], ['Director del Centro Educativo', 'director'], ['Directora Provincial', 'provincial_director'], ['Profesor', 'professor'], ['Adjunto PDF', 'pdf'] ]; const parts = []; map.forEach(([label, key]) => { const el = document.querySelector(`[data-field='${key}']`); if (el && el.textContent.trim()) parts.push(`${label}: ${el.textContent.trim()}`); }); return parts.join('\n'); }
// show a small toast notification function showToast(text, timeout = 1400) { let t = document.getElementById('copy-toast'); if (!t) { t = document.createElement('div'); t.id = 'copy-toast'; t.className = 'toast'; document.body.appendChild(t); } t.textContent = text; t.classList.add('show'); setTimeout(() => t.classList.remove('show'), timeout); }
document.getElementById('copy-all-btn').addEventListener('click', function () { const text = buildSummary(); if (!text) { showToast('No hay datos para copiar'); return; } copyText(text, this); showToast('Resumen copiado'); });
// top button that also copies the same summary const topBtn = document.getElementById('copy-top-btn'); if (topBtn) { topBtn.addEventListener('click', function () { const text = buildSummary(); if (!text) { showToast('No hay datos para copiar'); return; } copyText(text, this); showToast('Datos copiados'); }); }</script> t.textContent = text; t.classList.add('show'); setTimeout(() => t.classList.remove('show'), timeout); }
const copyAll = document.getElementById('copy-all-btn'); if (copyAll) { copyAll.addEventListener('click', function () { const text = buildSummary(); if (!text) { showToast('No hay datos para copiar'); return; } copyText(text, this); showToast('Resumen copiado'); }); }
// top button that also copies the same summary (if present) const topBtn = document.getElementById('copy-top-btn'); if (topBtn) { topBtn.addEventListener('click', function () { const text = buildSummary(); if (!text) { showToast('No hay datos para copiar'); return; } copyText(text, this); showToast('Datos copiados'); }); } </script>
</body>
</html></html>23 unmodified lines242526272823 unmodified lines entity_id = db.Column(db.Integer, db.ForeignKey("entity.id"))
hash_code = db.Column(db.String(100), unique=True, default=lambda: uuid.uuid4().hex) # Path to generated QR image (relative to static folder), set after QR generation qr_path = db.Column(db.String(255), nullable=True)79 unmodified lines808182838384858679 unmodified lines # browser POST: redirect based on role if getattr(user, "role", "user") == "admin": return redirect(url_for("admin.list_pending")) return redirect(url_for("diploma.create_diploma")) return redirect(url_for("diploma.list_diplomas"))
@auth_bp.route("/logout", methods=["GET", "POST"])101 unmodified lines10210310410510610710810911011111211311411517 unmodified lines133134135136137138139140141142143144145146147148149150151152153154155156157158159160101 unmodified lines with open(qr_path, "wb") as qr_file: qr.save(qr_file)
# Save QR path to the diploma record in DB try: diploma.qr_path = f"/static/qrs/{diploma.hash_code}.png" db.session.add(diploma) db.session.commit() except Exception: db.session.rollback()
# save uploaded pdf if present if not request.is_json and "pdf" in request.files: pdf = request.files["pdf"]17 unmodified lines }
@diploma_bp.route("/", methods=["GET"])@login_requireddef list_diplomas(): # show a table of diplomas (student titles) with actions to view and create diplomas = Diploma.query.order_by(Diploma.student_name).all() # pass minimal fields to template; skip any None entries and use getattr for safety rows = [] for d in diplomas: if d is None: continue rows.append({ "student_name": getattr(d, "student_name", "") or "", "student_id": getattr(d, "student_id", "") or "", "title": getattr(d, "certification_title", "") or "", "graduation_year": getattr(d, "graduation_year", "") or "", "registration_number": getattr(d, "registration_number", "") or "", "hash_code": getattr(d, "hash_code", ""), "qr_path": getattr(d, "qr_path", "") or "", }) return render_template("diploma_list.html", diplomas=rows)
@diploma_bp.route('/view/<hash_code>')def view_diploma(hash_code): diploma = Diploma.query.filter_by(hash_code=hash_code).first()1 unmodified line234567883 unmodified lines92939495969798991001011021031041051061 unmodified line<html lang="es"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Usuarios Pendientes</title>
<style>83 unmodified lines to { opacity: 1; transform: translateY(0); } }
/* Responsive tweaks */ @media (max-width: 700px) { body { padding: 12px; } .top-bar { flex-direction: column; align-items: flex-start; gap:10px; } .card { padding: 12px; } li { flex-direction: column; align-items: flex-start; gap:8px; } .btn { width: 100%; } }
</style></head>
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768<!doctype html><html lang="es"><head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Lista de Diplomas</title> <style> body { font-family: "Segoe UI", sans-serif; background: #0f172a; color: #e5e7eb; padding: 30px; } .container { max-width: 1000px; margin: 0 auto; } h2 { color: #93c5fd; } .top-actions { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; } a.button { background:#3b82f6; color:#fff; padding:10px 14px; border-radius:8px; text-decoration:none; font-weight:600 } table { width:100%; border-collapse:collapse; margin-top:12px; background:#0b1220; border-radius:8px; overflow:hidden } th, td { padding:10px 12px; text-align:left; border-bottom:1px solid rgba(255,255,255,0.04); } th { background:#071027; color:#93c5fd; font-weight:700 } tr:hover td { background: rgba(255,255,255,0.02) } .action-btn { background:#10b981; color:#fff; padding:6px 10px; border-radius:6px; text-decoration:none; font-weight:700 } /* Responsive tweaks */ @media (max-width: 800px) { .container { padding: 12px; } .top-actions { flex-direction: column; align-items: flex-start; gap:8px; } .top-actions .button { width: 100%; display:block; } table { display: block; overflow-x: auto; width: 100%; -webkit-overflow-scrolling: touch; } table th, table td { white-space: nowrap; } } </style></head><body><div class="container"> <div class="top-actions"> <h2>Diplomas emitidos</h2> <div> <a class="button" href="/diploma/create">Emitir & Generar QR</a> <a class="button" href="{{ url_for('auth.logout') }}" style="background:#ef4444; margin-left:10px;">Cerrar sesión</a> </div> </div>
<table> <thead> <tr> <th>Nombre del Estudiante</th> <th>Cédula</th> <th>Título</th> <th>Año</th> <th>Número de Registro</th> <th>Acciones</th> </tr> </thead> <tbody> {% for d in diplomas %} <tr> <td>{{ d.student_name }}</td> <td>{{ d.student_id }}</td> <td>{{ d.title }}</td> <td>{{ d.graduation_year }}</td> <td>{{ d.registration_number }}</td> <td> <a class="action-btn" href="/api/verify/{{ d.hash_code }}">Ver datos</a> </td> </tr> {% else %} <tr><td colspan="6">No hay diplomas registrados.</td></tr> {% endfor %} </tbody> </table></div></body></html>1 unmodified line2345678106 unmodified lines1151161171181191201211221231241251261271281291 unmodified line<html lang="es"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Emitir Diploma (Admin)</title> <style> body {106 unmodified lines from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* Responsive tweaks */ @media (max-width: 768px) { body { padding: 18px; } .cert-form { width: 100% !important; max-width: 100%; padding: 1rem; box-sizing: border-box; } .topbar { flex-direction: column; align-items: flex-start; gap: 12px; } h2 { font-size: 20px; } button[type="submit"] { font-size: 15px; } } </style></head>
1 unmodified line2345678125 unmodified lines1341351361371381391401411421431441451461471481491501511521531 unmodified line<html lang="es"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Diploma Creado</title> <style> body {125 unmodified lines from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* Responsive tweaks */ @media (max-width: 900px) { .grid { grid-template-columns: 1fr; width: 100%; padding: 1rem; } .card { padding: 1rem; } img { max-width: 100%; } .button-like { font-size: 15px; } }
@media (max-width: 480px) { body { padding: 12px; } .topbar { padding: 10px; } h2 { font-size: 18px; } } </style></head><body>1 unmodified line234567879 unmodified lines8889909192939495969798991001011 unmodified line<html lang="es"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Login</title> <style> body {79 unmodified lines from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
/* Responsive tweaks */ @media (max-width: 640px) { body { padding: 18px; align-items: flex-start; height: auto; } form { width: 100% !important; max-width: 420px; margin: 40px auto; padding: 1.25rem; box-sizing: border-box; } h2 { font-size: 20px; } input, button { font-size: 15px; } } </style></head><body>1 unmodified line234567897 unmodified lines1061071081091101111121131141151161171181191201211 unmodified line<html lang="es"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Diploma Verificado</title> <style> body {97 unmodified lines to { opacity: 1; transform: translateY(0); } } </style>
<style> /* Responsive tweaks */ @media (max-width: 680px) { body { padding: 12px; align-items: flex-start; } .card { width: 100%; max-width: 100%; padding: 1rem; box-sizing: border-box; } h2 { font-size: 20px; } .copy-btn, a.download { padding: 10px 12px; font-size: 14px; } } </style></head><body>
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869#!/usr/bin/env python3"""Script para añadir la columna `qr_path` a la tabla `diploma` si no existe.
Uso: python scripts\add_qr_column.py
Esto asume que la URI de la BD está en `config.Config.SQLALCHEMY_DATABASE_URI`.Si usas otra BD que no sea SQLite, revisa el script antes de ejecutarlo."""import sqlite3import osimport sys
from config import Config
def get_sqlite_path(uri: str) -> str: # support sqlite:///relative/path.db or sqlite:////absolute/path.db if not uri.startswith("sqlite:"): raise RuntimeError("Este script solo soporta sqlite URIs (ej: sqlite:///data.db)") # strip prefix if uri.startswith("sqlite:///"): return uri.replace("sqlite:///", "") if uri.startswith("sqlite:////"): return uri.replace("sqlite:////", "/") # fallback return uri.split("sqlite://")[-1]
def main(): uri = getattr(Config, "SQLALCHEMY_DATABASE_URI", None) if not uri: print("No se encontró SQLALCHEMY_DATABASE_URI en config.Config", file=sys.stderr) sys.exit(1)
try: db_path = get_sqlite_path(uri) except RuntimeError as e: print("ERROR:", e, file=sys.stderr) sys.exit(1)
if not os.path.exists(db_path): print(f"Archivo de BD no encontrado: {db_path}", file=sys.stderr) sys.exit(1)
conn = sqlite3.connect(db_path) try: cur = conn.cursor() cur.execute("PRAGMA table_info('diploma')") cols = [r[1] for r in cur.fetchall()] if 'qr_path' in cols: print("La columna 'qr_path' ya existe. No se realizaron cambios.") return
# Add column (nullable) — safe for SQLite print("Añadiendo columna 'qr_path' a la tabla 'diploma'...") cur.execute("ALTER TABLE diploma ADD COLUMN qr_path VARCHAR(255);") conn.commit() print("Columna 'qr_path' añadida correctamente.") except sqlite3.OperationalError as e: print("Error operativo de sqlite:", e, file=sys.stderr) sys.exit(2) finally: conn.close()
if __name__ == '__main__': main()__pycache__/app.cpython-313.pyc
app.py+11-2
app/models/diploma.py+2
app/routes/auth.py+1-1
app/routes/diploma.py+37
app/templates/admin_pending.html+10
app/templates/diploma_list.htmlAdded+68
app/templates/issue.html+10
app/templates/issue_success.html+15
app/templates/login.html+9
app/templates/register.html+9
app/templates/verify.html+165-125
app_pkg/models/__pycache__/diploma.cpython-313.pyc
app_pkg/models/diploma.py+2
app_pkg/routes/__pycache__/auth.cpython-313.pyc
app_pkg/routes/__pycache__/diploma.cpython-313.pyc
app_pkg/routes/auth.py+1-1
app_pkg/routes/diploma.py+30
app_pkg/static/pdfs/002a47521e8645f7b7ffa388cc39c4f4.pdfAdded
app_pkg/static/pdfs/1012185aa1124c829477b6a548c687e0.pdfAdded
app_pkg/static/pdfs/6dd3f794fdb645b4a0edb1d6aff30620.pdfAdded
app_pkg/static/qrs/002a47521e8645f7b7ffa388cc39c4f4.pngAdded

app_pkg/static/qrs/1012185aa1124c829477b6a548c687e0.pngAdded

app_pkg/static/qrs/6dd3f794fdb645b4a0edb1d6aff30620.pngAdded

app_pkg/templates/admin_pending.html+10
app_pkg/templates/diploma_list.htmlAdded+68
app_pkg/templates/issue.html+10
app_pkg/templates/issue_success.html+15
app_pkg/templates/login.html+9
app_pkg/templates/verify.html+11
instance/data.db
scripts/add_qr_column.pyAdded+69