Fix admin route access and backend configuration
- Added /admin redirect to login page in nginx config - Fixed backend server.js route ordering for proper admin handling - Updated authentication middleware and routes - Added user management routes - Configured PostgreSQL integration - Updated environment configuration
This commit is contained in:
430
Views/Admin/Login.cshtml
Executable file
430
Views/Admin/Login.cshtml
Executable file
@@ -0,0 +1,430 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" data-bs-theme="light">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta name="color-scheme" content="light">
|
||||
<title>SkyArt - @ViewData["Title"]</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet" data-theme="light">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.0/font/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
||||
<style>
|
||||
:root {
|
||||
color-scheme: light !important;
|
||||
}
|
||||
|
||||
html {
|
||||
color-scheme: light !important;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
overflow-x: hidden;
|
||||
background-color: #f8f9fa !important;
|
||||
color: #212529 !important;
|
||||
color-scheme: light !important;
|
||||
}
|
||||
|
||||
/* Force all Bootstrap components to light mode */
|
||||
* {
|
||||
color-scheme: light !important;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
background-color: #ffffff !important;
|
||||
color: #212529 !important;
|
||||
}
|
||||
|
||||
.card {
|
||||
background-color: #ffffff !important;
|
||||
color: #212529 !important;
|
||||
}
|
||||
|
||||
.table {
|
||||
background-color: #ffffff !important;
|
||||
color: #212529 !important;
|
||||
}
|
||||
|
||||
input, textarea, select {
|
||||
background-color: #ffffff !important;
|
||||
color: #212529 !important;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
height: 100vh;
|
||||
background: linear-gradient(180deg, #2c3e50 0%, #1a252f 100%);
|
||||
color: white;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 250px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.sidebar::-webkit-scrollbar {
|
||||
width: 6px;
|
||||
}
|
||||
|
||||
.sidebar::-webkit-scrollbar-track {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
border-radius: 10px;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.sidebar::-webkit-scrollbar-thumb {
|
||||
background: rgba(52, 152, 219, 0.6);
|
||||
border-radius: 10px;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
|
||||
.sidebar::-webkit-scrollbar-thumb:hover {
|
||||
background: rgba(52, 152, 219, 1);
|
||||
}
|
||||
|
||||
/* Firefox scrollbar */
|
||||
.sidebar {
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgba(52, 152, 219, 0.6) rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.sidebar .brand {
|
||||
padding: 20px;
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
background: linear-gradient(180deg, #2c3e50 0%, #243442 100%);
|
||||
z-index: 10;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
.sidebar nav {
|
||||
padding: 10px 0 30px 0;
|
||||
}
|
||||
|
||||
.sidebar hr {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
.sidebar .section-label {
|
||||
padding: 15px 20px 5px 20px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.sidebar .nav-link {
|
||||
color: rgba(255, 255, 255, 0.85);
|
||||
padding: 12px 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
transition: all 0.3s ease;
|
||||
border-left: 3px solid transparent;
|
||||
text-decoration: none;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.sidebar .nav-link:hover {
|
||||
background: rgba(52, 152, 219, 0.15);
|
||||
color: white;
|
||||
border-left-color: #3498db;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.sidebar .nav-link.active {
|
||||
background: rgba(52, 152, 219, 0.25);
|
||||
color: white;
|
||||
border-left-color: #3498db;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.sidebar .nav-link.active::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 3px;
|
||||
background: #3498db;
|
||||
box-shadow: 0 0 10px #3498db;
|
||||
}
|
||||
|
||||
.sidebar .nav-link i {
|
||||
margin-right: 12px;
|
||||
width: 20px;
|
||||
font-size: 1.1rem;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.sidebar .nav-link:hover i {
|
||||
transform: scale(1.2);
|
||||
}
|
||||
|
||||
.main-content {
|
||||
margin-left: 250px;
|
||||
padding: 20px;
|
||||
background: #f8f9fa;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.top-bar {
|
||||
background: white;
|
||||
padding: 15px 30px;
|
||||
margin: -20px -20px 20px -20px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.card {
|
||||
border: none;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.dashboard-stat-card {
|
||||
transition: all 0.3s ease;
|
||||
cursor: pointer;
|
||||
border-left: 4px solid transparent;
|
||||
}
|
||||
|
||||
.dashboard-stat-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
|
||||
border-left-color: #3498db;
|
||||
}
|
||||
|
||||
.dashboard-stat-card h6 {
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
.dashboard-stat-card h2 {
|
||||
color: #2c3e50;
|
||||
font-weight: 700;
|
||||
font-size: 2.5rem;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.stat-link {
|
||||
color: #3498db;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
display: inline-block;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.dashboard-stat-card:hover .stat-link {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.system-info-card {
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: white;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.system-info-card .card-header {
|
||||
background: transparent;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.system-info-card .card-body p {
|
||||
color: rgba(255, 255, 255, 0.95);
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.btn-group-sm .btn {
|
||||
padding: 0.25rem 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
||||
.alert {
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
/* Scroll indicator */
|
||||
.scroll-indicator {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 40px;
|
||||
background: linear-gradient(to top, #1a252f 0%, transparent 100%);
|
||||
pointer-events: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
|
||||
.scroll-indicator.hidden {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.scroll-indicator i {
|
||||
color: rgba(52, 152, 219, 0.8);
|
||||
font-size: 1.5rem;
|
||||
animation: bounce 2s infinite;
|
||||
}
|
||||
|
||||
@@keyframes bounce {
|
||||
0%, 20%, 50%, 80%, 100% {
|
||||
transform: translateY(0);
|
||||
}
|
||||
40% {
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
60% {
|
||||
transform: translateY(-5px);
|
||||
}
|
||||
}
|
||||
|
||||
/* Mobile responsive */
|
||||
@@media (max-width: 768px) {
|
||||
.sidebar {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
margin-left: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="sidebar">
|
||||
<div class="brand">
|
||||
<i class="bi bi-shop"></i> Sky Art Shop
|
||||
</div>
|
||||
<nav class="nav flex-column">
|
||||
<a class="nav-link @(ViewContext.RouteData.Values["Action"]?.ToString() == "Dashboard" ? "active" : "")"
|
||||
href="/admin/dashboard">
|
||||
<i class="bi bi-speedometer2"></i> Dashboard
|
||||
</a>
|
||||
|
||||
<div class="section-label">
|
||||
<i class="bi bi-folder"></i> CONTENT
|
||||
</div>
|
||||
<a class="nav-link @(ViewContext.RouteData.Values["Controller"]?.ToString() == "AdminPages" ? "active" : "")"
|
||||
href="/admin/pages">
|
||||
<i class="bi bi-file-earmark-text"></i> Pages
|
||||
</a>
|
||||
<a class="nav-link @(ViewContext.RouteData.Values["Controller"]?.ToString() == "AdminBlog" ? "active" : "")"
|
||||
href="/admin/blog">
|
||||
<i class="bi bi-journal-text"></i> Blog
|
||||
</a>
|
||||
<a class="nav-link @(ViewContext.RouteData.Values["Controller"]?.ToString() == "AdminPortfolio" ? "active" : "")"
|
||||
href="/admin/portfolio/categories">
|
||||
<i class="bi bi-images"></i> Portfolio
|
||||
</a>
|
||||
<a class="nav-link @(ViewContext.RouteData.Values["Controller"]?.ToString() == "AdminProducts" ? "active" : "")"
|
||||
href="/admin/products">
|
||||
<i class="bi bi-cart"></i> Products
|
||||
</a>
|
||||
|
||||
<div class="section-label">
|
||||
<i class="bi bi-gear"></i> SETTINGS
|
||||
</div>
|
||||
<a class="nav-link @(ViewContext.RouteData.Values["Controller"]?.ToString() == "AdminUsers" ? "active" : "")"
|
||||
href="/admin/users">
|
||||
<i class="bi bi-people"></i> User Management
|
||||
</a>
|
||||
<a class="nav-link @(ViewContext.RouteData.Values["Controller"]?.ToString() == "AdminHomepage" ? "active" : "")"
|
||||
href="/admin/homepage">
|
||||
<i class="bi bi-house-fill"></i> Homepage Editor
|
||||
</a>
|
||||
<a class="nav-link @(ViewContext.RouteData.Values["Controller"]?.ToString() == "AdminMenu" ? "active" : "")"
|
||||
href="/admin/menu">
|
||||
<i class="bi bi-list"></i> Navigation Menu
|
||||
</a>
|
||||
<a class="nav-link @(ViewContext.RouteData.Values["Controller"]?.ToString() == "AdminSettings" ? "active" : "")"
|
||||
href="/admin/settings">
|
||||
<i class="bi bi-gear"></i> Site Settings
|
||||
</a>
|
||||
<a class="nav-link @(ViewContext.RouteData.Values["Controller"]?.ToString() == "AdminUpload" ? "active" : "")"
|
||||
href="/admin/upload">
|
||||
<i class="bi bi-cloud-upload"></i> Media Upload
|
||||
</a>
|
||||
|
||||
<div class="section-label">
|
||||
<i class="bi bi-layout-sidebar"></i> SYSTEM
|
||||
</div>
|
||||
<a class="nav-link" href="/" target="_blank">
|
||||
<i class="bi bi-box-arrow-up-right"></i> View Site
|
||||
</a>
|
||||
<a class="nav-link" href="/admin/logout">
|
||||
<i class="bi bi-box-arrow-right"></i> Logout
|
||||
</a>
|
||||
</nav>
|
||||
<div class="scroll-indicator" id="scrollIndicator">
|
||||
<i class="bi bi-chevron-down"></i>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="main-content">
|
||||
<div class="top-bar">
|
||||
<h4 class="mb-0">@ViewData["Title"]</h4>
|
||||
<div>
|
||||
<span class="text-muted">Welcome, Admin</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<partial name="_AdminAlerts" />
|
||||
|
||||
@RenderBody()
|
||||
</div>
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="https://cdn.ckeditor.com/ckeditor5/40.1.0/classic/ckeditor.js"></script>
|
||||
<script src="~/assets/js/admin.js"></script>
|
||||
|
||||
<script>
|
||||
// Sidebar scroll indicator
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const sidebar = document.querySelector('.sidebar');
|
||||
const scrollIndicator = document.getElementById('scrollIndicator');
|
||||
|
||||
if (sidebar && scrollIndicator) {
|
||||
function updateScrollIndicator() {
|
||||
const isAtBottom = sidebar.scrollHeight - sidebar.scrollTop <= sidebar.clientHeight + 10;
|
||||
if (isAtBottom) {
|
||||
scrollIndicator.classList.add('hidden');
|
||||
} else {
|
||||
scrollIndicator.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// Check on scroll
|
||||
sidebar.addEventListener('scroll', updateScrollIndicator);
|
||||
|
||||
// Initial check
|
||||
updateScrollIndicator();
|
||||
|
||||
// Check after window resize
|
||||
window.addEventListener('resize', updateScrollIndicator);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user