User management and module improvements
- Added daily_mirror module to permissions system - Fixed user module management - updates now work correctly - Implemented dashboard module filtering based on user permissions - Fixed warehouse create_locations page (config parser and delete) - Implemented POST-Redirect-GET pattern to prevent duplicate entries - Added application license system with validation middleware - Cleaned up debug logging code - Improved user module selection with fetch API instead of form submit
This commit is contained in:
@@ -304,6 +304,81 @@
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="qz-pairing-card" style="margin-top: 40px;">
|
||||
<h2>🔐 Application License Management</h2>
|
||||
|
||||
{% if license_data %}
|
||||
<div class="qz-result" style="{% if license_data.days_remaining <= 30 %}background: #fff3e0; border-left-color: #ff9800;{% elif license_data.days_remaining <= 7 %}background: #ffebee; border-left-color: #f44336;{% endif %}">
|
||||
<div style="margin-bottom: 8px;">
|
||||
<strong>🔑 License Key:</strong> <span>{{ license_data.license_key }}</span>
|
||||
</div>
|
||||
<div style="margin-bottom: 8px;">
|
||||
<strong>📅 Created:</strong> {{ license_data.created_at }}
|
||||
</div>
|
||||
<div style="margin-bottom: 8px;">
|
||||
<strong>⏰ Valid Until:</strong> {{ license_data.valid_until }}
|
||||
{% if license_data.days_remaining is defined %}
|
||||
{% if license_data.days_remaining > 0 %}
|
||||
<span style="margin-left: 8px; padding: 2px 8px; background: {% if license_data.days_remaining <= 7 %}#f44336{% elif license_data.days_remaining <= 30 %}#ff9800{% else %}#4caf50{% endif %}; color: white; border-radius: 4px; font-size: 0.85em;">
|
||||
{{ license_data.days_remaining }} days remaining
|
||||
</span>
|
||||
{% else %}
|
||||
<span style="margin-left: 8px; padding: 2px 8px; background: #f44336; color: white; border-radius: 4px; font-size: 0.85em;">
|
||||
⚠️ EXPIRED
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div style="margin-top: 16px;">
|
||||
<form method="POST" action="/revoke_app_license" style="display: inline-block;">
|
||||
<button class="btn-delete" type="submit" onclick="return confirm('Are you sure you want to REVOKE the application license?\n\nThis will prevent all non-superadmin users from accessing the application!\n\nThis action cannot be undone.');">
|
||||
🗑️ Revoke License
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div style="padding: 24px; background: #ffebee; border-left: 4px solid #f44336; border-radius: 6px; margin-bottom: 24px;">
|
||||
<strong style="color: #c62828;">⚠️ No Active License</strong>
|
||||
<p style="margin: 8px 0 0 0; color: #d32f2f;">
|
||||
No application license has been generated. Non-superadmin users will not be able to access the application.
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h3>🔑 Generate New License</h3>
|
||||
<form id="license-form" method="POST" action="/generate_app_license" class="qz-form-group">
|
||||
<div class="form-row">
|
||||
<div class="form-field">
|
||||
<label for="license_validity_days">License Validity Period:</label>
|
||||
<select id="license_validity_days" name="validity_days">
|
||||
<option value="30">30 Days (1 Month)</option>
|
||||
<option value="90">90 Days (3 Months)</option>
|
||||
<option value="180">180 Days (6 Months)</option>
|
||||
<option value="365" selected>365 Days (1 Year)</option>
|
||||
<option value="730">730 Days (2 Years)</option>
|
||||
<option value="1825">1825 Days (5 Years)</option>
|
||||
<option value="3650">3650 Days (10 Years)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button type="submit" onclick="return confirm('{% if license_data %}This will replace the existing license key.\n\n{% endif %}Are you sure you want to generate a new application license?');">
|
||||
🔑 Generate License Key
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<div style="margin-top: 24px; padding: 16px; background: var(--info-bg, #e3f2fd); border-left: 4px solid #2196f3; border-radius: 6px;">
|
||||
<strong style="color: var(--info-text, #0d47a1);">ℹ️ License Information</strong>
|
||||
<ul style="margin: 8px 0 0 0; color: var(--info-text, #1565c0); font-size: 0.9em;">
|
||||
<li>The application license controls access for all non-superadmin users</li>
|
||||
<li>Superadmin accounts can always access the application regardless of license status</li>
|
||||
<li>When the license expires, non-superadmin users will see an expiration message</li>
|
||||
<li>Generating a new license will replace any existing license</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function deletePairingKey(pairingKey, printerName) {
|
||||
if (confirm(`Are you sure you want to delete the pairing key for "${printerName}"?\n\nKey: ${pairingKey}\n\nThis action cannot be undone.`)) {
|
||||
|
||||
Reference in New Issue
Block a user