error pages

This commit is contained in:
2025-06-06 10:35:56 +02:00
parent d619283d09
commit 8509b0567b
9 changed files with 164 additions and 0 deletions

19
templates/common/400.html Normal file
View File

@@ -0,0 +1,19 @@
{% extends "common/base.html" %}
{% block title %}Bad Request - 400{% endblock %}
{% block content %}
<div class="container mx-auto px-4 py-16 text-center">
<h1 class="display-1 fw-bold" style="color: var(--primary-color);">400</h1>
<h2 class="mb-4">Bad Request</h2>
<p class="mb-4 text-muted">Sorry, the request could not be processed. Please check your input and try again.</p>
<div class="d-flex justify-content-center gap-3">
<a href="{{ url_for('main.dashboard') }}" class="btn btn-primary">
<i class="fas fa-home me-2"></i>Back to Dashboard
</a>
<button onclick="window.history.back()" class="btn btn-outline-primary">
<i class="fas fa-arrow-left me-2"></i>Go Back
</button>
</div>
</div>
{% endblock %}

19
templates/common/401.html Normal file
View File

@@ -0,0 +1,19 @@
{% extends "common/base.html" %}
{% block title %}Authentication Required - 401{% endblock %}
{% block content %}
<div class="container mx-auto px-4 py-16 text-center">
<h1 class="display-1 fw-bold" style="color: var(--primary-color);">401</h1>
<h2 class="mb-4">Authentication Required</h2>
<p class="mb-4 text-muted">Please log in to access this resource.</p>
<div class="d-flex justify-content-center gap-3">
<a href="{{ url_for('auth.login') }}" class="btn btn-primary">
<i class="fas fa-sign-in-alt me-2"></i>Log In
</a>
<button onclick="window.history.back()" class="btn btn-outline-primary">
<i class="fas fa-arrow-left me-2"></i>Go Back
</button>
</div>
</div>
{% endblock %}

19
templates/common/403.html Normal file
View File

@@ -0,0 +1,19 @@
{% extends "common/base.html" %}
{% block title %}Access Denied - 403{% endblock %}
{% block content %}
<div class="container mx-auto px-4 py-16 text-center">
<h1 class="display-1 fw-bold" style="color: var(--primary-color);">403</h1>
<h2 class="mb-4">Access Denied</h2>
<p class="mb-4 text-muted">Sorry, you don't have permission to access this resource.</p>
<div class="d-flex justify-content-center gap-3">
<a href="{{ url_for('main.dashboard') }}" class="btn btn-primary">
<i class="fas fa-home me-2"></i>Back to Dashboard
</a>
<button onclick="window.history.back()" class="btn btn-outline-primary">
<i class="fas fa-arrow-left me-2"></i>Go Back
</button>
</div>
</div>
{% endblock %}

15
templates/common/404.html Normal file
View File

@@ -0,0 +1,15 @@
{% extends "common/base.html" %}
{% block title %}Page Not Found - 404{% endblock %}
{% block content %}
<div class="container mx-auto px-4 py-16 text-center">
<h1 class="display-1 fw-bold" style="color: var(--primary-color);">404</h1>
<h2 class="mb-4">Page Not Found</h2>
<p class="mb-4 text-muted">Sorry, the page you are looking for does not exist or has been moved.</p>
<p class="mb-4 text-muted">If you were trying to access a room, conversation, or file, it may have been deleted by an administrator.</p>
<a href="{{ url_for('main.dashboard') }}" class="btn btn-primary">
<i class="fas fa-home me-2"></i>Back to Dashboard
</a>
</div>
{% endblock %}

55
templates/common/500.html Normal file
View File

@@ -0,0 +1,55 @@
{% extends "common/base.html" %}
{% block title %}Server Error - 500{% endblock %}
{% block content %}
<div class="container mx-auto px-4 py-16 text-center">
<h1 class="display-1 fw-bold" style="color: var(--primary-color);">500</h1>
<h2 class="mb-4">Internal Server Error</h2>
<p class="mb-4 text-muted">Sorry, something went wrong on our end. Our team has been notified and we're working to fix it.</p>
<div class="d-flex justify-content-center gap-3 mb-4">
<a href="{{ url_for('main.dashboard') }}" class="btn btn-primary">
<i class="fas fa-home me-2"></i>Back to Dashboard
</a>
<button onclick="window.location.reload()" class="btn btn-outline-primary">
<i class="fas fa-sync-alt me-2"></i>Try Again
</button>
</div>
<!-- Error Details Section -->
<div class="mt-4">
<button class="btn btn-link text-muted" type="button" data-bs-toggle="collapse" data-bs-target="#errorDetails" aria-expanded="false" aria-controls="errorDetails">
<i class="fas fa-info-circle me-2"></i>Show Error Details
</button>
<div class="collapse mt-3" id="errorDetails">
<div class="card">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-2">
<h6 class="card-subtitle text-muted">Error Details</h6>
<button class="btn btn-sm btn-outline-secondary" onclick="copyErrorDetails()">
<i class="fas fa-copy me-1"></i>Copy
</button>
</div>
<pre class="text-start mb-0" style="font-size: 0.875rem; max-height: 200px; overflow-y: auto;" id="errorText">{{ error }}</pre>
</div>
</div>
</div>
</div>
</div>
{% block extra_js %}
<script>
function copyErrorDetails() {
const errorText = document.getElementById('errorText').textContent;
navigator.clipboard.writeText(errorText).then(() => {
const copyBtn = document.querySelector('#errorDetails .btn');
const originalText = copyBtn.innerHTML;
copyBtn.innerHTML = '<i class="fas fa-check me-1"></i>Copied!';
setTimeout(() => {
copyBtn.innerHTML = originalText;
}, 2000);
});
}
</script>
{% endblock %}
{% endblock %}