Lifted JWT-cookie auth pattern from the AI QC sibling project: core/auth/middleware.py validates Azure AD JWTs and stores them in an httpOnly cookie (hm_aiqc_auth_token). Tenant membership is enforced by JWTValidator's tid check, which is sufficient for the tenant-wide access policy chosen for this project. templates/login.html now drives an MSAL.js popup that POSTs the ID token to /auth/login. base.html exposes Azure config to all pages so the logout button can also clear the MSAL session. app.py's @before_request now checks the JWT cookie and exposes g.user; modules read user identity via core.auth.current_user_email so usage logs and created_by columns now record the signed-in user's email rather than a session value. Legacy username/password code removed: top-level auth_middleware.py, jwt_validator.py, deploy/generate_password.py.
162 lines
6.2 KiB
HTML
162 lines
6.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>{% block title %}HM QC Platform{% endblock %}</title>
|
|
|
|
<!-- Bootstrap 5 -->
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
|
|
<!-- Bootstrap Icons -->
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
|
|
|
|
<!-- Unified Theme CSS -->
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/unified_theme.css') }}">
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='css/tabs.css') }}">
|
|
|
|
<!-- MSAL Browser Library (used by auth.js for sign-out popup) -->
|
|
<script src="https://alcdn.msauth.net/browser/2.35.0/js/msal-browser.min.js" crossorigin="anonymous"></script>
|
|
|
|
{% block extra_head %}{% endblock %}
|
|
</head>
|
|
<body>
|
|
<!-- BASE_URL + Azure config for JavaScript -->
|
|
<script>
|
|
window.BASE_URL = "{{ request.script_root }}";
|
|
window.AZURE_TENANT_ID = "{{ azure_tenant_id }}";
|
|
window.AZURE_CLIENT_ID = "{{ azure_client_id }}";
|
|
</script>
|
|
|
|
<!-- Top Navigation Bar -->
|
|
<nav class="navbar navbar-dark hm-navbar">
|
|
<div class="container-fluid">
|
|
<!-- Brand -->
|
|
<div class="navbar-brand-wrapper">
|
|
<span class="navbar-brand mb-0 h1">
|
|
<i class="bi bi-shield-check me-2"></i>
|
|
HM QC Platform
|
|
</span>
|
|
<span class="badge bg-secondary ms-2 version-badge">v1.0</span>
|
|
</div>
|
|
|
|
<!-- User Info -->
|
|
<div class="d-flex align-items-center">
|
|
{% set _user = g.get('user') %}
|
|
<span class="text-white me-3">
|
|
<i class="bi bi-person-circle me-1"></i>
|
|
{{ (_user.name or _user.email) if _user else 'User' }}
|
|
</span>
|
|
<button id="logoutBtn" class="btn btn-sm btn-outline-light">
|
|
<i class="bi bi-box-arrow-right me-1"></i>
|
|
Logout
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- Tab Navigation -->
|
|
<ul class="nav nav-tabs hm-tabs" role="tablist">
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link {% if active_tab == 'reporting' %}active{% endif %}"
|
|
href="{{ url_for('reporting.index') }}"
|
|
data-tab="reporting"
|
|
role="tab">
|
|
<i class="bi bi-file-bar-graph me-2"></i>
|
|
Reporting
|
|
</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link {% if active_tab == 'hm-qc' %}active{% endif %}"
|
|
href="{{ url_for('hm_qc.index') }}"
|
|
data-tab="hm-qc"
|
|
role="tab">
|
|
<i class="bi bi-file-earmark-check me-2"></i>
|
|
HM QC
|
|
</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link {% if active_tab == 'video-qc' %}active{% endif %}"
|
|
href="{{ url_for('video_qc.index') }}"
|
|
data-tab="video-qc"
|
|
role="tab">
|
|
<i class="bi bi-play-circle me-2"></i>
|
|
Video QC
|
|
<span class="badge bg-warning text-dark ms-2 beta-badge">BETA</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link {% if active_tab == 'video-master' %}active{% endif %}"
|
|
href="{{ url_for('video_master.index') }}"
|
|
data-tab="video-master"
|
|
role="tab">
|
|
<i class="bi bi-camera-video me-2"></i>
|
|
Video Master Adot
|
|
<span class="badge bg-warning text-dark ms-2 beta-badge">BETA</span>
|
|
</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link {% if active_tab == 'printer-check' %}active{% endif %}"
|
|
href="{{ url_for('printer_check.index') }}"
|
|
data-tab="printer-check"
|
|
role="tab">
|
|
<i class="bi bi-printer me-2"></i>
|
|
Printer Check
|
|
</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link {% if active_tab == 'campaigns' %}active{% endif %}"
|
|
href="{{ url_for('campaigns.index') }}"
|
|
data-tab="campaigns"
|
|
role="tab">
|
|
<i class="bi bi-collection me-2"></i>
|
|
Campaigns
|
|
</a>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<a class="nav-link {% if active_tab == 'usage' %}active{% endif %}"
|
|
href="{{ url_for('usage.index') }}"
|
|
data-tab="usage"
|
|
role="tab">
|
|
<i class="bi bi-speedometer2 me-2"></i>
|
|
Usage
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<!-- Main Content Area -->
|
|
<div class="content-wrapper">
|
|
{% block content %}
|
|
<!-- Page content goes here -->
|
|
{% endblock %}
|
|
</div>
|
|
|
|
<!-- Footer -->
|
|
<footer class="hm-footer">
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<small class="text-muted">
|
|
© 2025 H&M QC Platform
|
|
</small>
|
|
</div>
|
|
<div class="col-md-6 text-end">
|
|
<small class="text-muted">
|
|
Powered by <a href="https://www.anthropic.com" target="_blank" class="text-muted">Claude AI</a>
|
|
</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
<!-- Bootstrap Bundle with Popper -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
|
|
<!-- Core JavaScript -->
|
|
<script src="{{ url_for('static', filename='js/auth.js') }}"></script>
|
|
<script src="{{ url_for('static', filename='js/tabs.js') }}"></script>
|
|
<script src="{{ url_for('static', filename='js/progress.js') }}"></script>
|
|
|
|
{% block extra_scripts %}{% endblock %}
|
|
</body>
|
|
</html>
|