feat: implement user authentication and license management system
- Added schema for users, licenses, and license hostnames in the database. - Created storage utility for reading and writing JSON files. - Developed user service for user registration, authentication, and retrieval. - Implemented authentication middleware to protect routes. - Built LicenseCard component to display license details. - Created SiteNav component for navigation with user authentication status. - Established AuthContext for managing authentication state and actions. - Developed Home page to display available plugins. - Created LicenseManager page for managing licenses with forms for creation and verification. - Implemented PluginDetail page to show detailed information about a specific plugin. - Added utility functions for date formatting.
This commit is contained in:
305
src/App.css
305
src/App.css
@@ -10,6 +10,59 @@
|
||||
padding: 48px 8vw 64px;
|
||||
}
|
||||
|
||||
.site-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
margin-bottom: 32px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.nav-logo {
|
||||
font-weight: 700;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.nav-user {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 0.9rem;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.nav-user-name {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.nav-user-guest {
|
||||
color: #94a3b8;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
padding: 8px 16px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid transparent;
|
||||
text-decoration: none;
|
||||
color: #475569;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.nav-link.active {
|
||||
background: #eef2ff;
|
||||
color: #4338ca;
|
||||
border-color: #c7d2fe;
|
||||
}
|
||||
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -46,6 +99,12 @@
|
||||
max-width: 520px;
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin: 8px 0 0;
|
||||
font-size: 0.9rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.cta {
|
||||
background: #4f46e5;
|
||||
color: #fff;
|
||||
@@ -55,6 +114,11 @@
|
||||
font-weight: 600;
|
||||
box-shadow: 0 8px 24px rgba(79, 70, 229, 0.2);
|
||||
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.cta:hover {
|
||||
@@ -62,6 +126,26 @@
|
||||
box-shadow: 0 12px 30px rgba(79, 70, 229, 0.3);
|
||||
}
|
||||
|
||||
.ghost {
|
||||
border: 1px solid #c7d2fe;
|
||||
color: #4338ca;
|
||||
padding: 8px 14px;
|
||||
border-radius: 999px;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ghost-small {
|
||||
padding: 6px 12px;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
||||
@@ -139,15 +223,6 @@
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ghost {
|
||||
border: 1px solid #c7d2fe;
|
||||
color: #4338ca;
|
||||
padding: 8px 14px;
|
||||
border-radius: 999px;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.state {
|
||||
background: #fff;
|
||||
border-radius: 16px;
|
||||
@@ -161,6 +236,16 @@
|
||||
color: #b91c1c;
|
||||
}
|
||||
|
||||
.state.success {
|
||||
background: #dcfce7;
|
||||
color: #166534;
|
||||
}
|
||||
|
||||
.state.inline {
|
||||
margin-top: 16px;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 48px;
|
||||
color: #94a3b8;
|
||||
@@ -225,6 +310,144 @@
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.license-meta-bar {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
flex-wrap: wrap;
|
||||
color: #64748b;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.license-forms {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.form-grid {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
font-size: 0.9rem;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.field input,
|
||||
.field select,
|
||||
.field textarea {
|
||||
border-radius: 12px;
|
||||
border: 1px solid #e2e8f0;
|
||||
padding: 10px 14px;
|
||||
font-size: 1rem;
|
||||
font-family: inherit;
|
||||
background: #fff;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.license-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.license-card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.license-card h3 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.license-subtitle {
|
||||
margin: 4px 0 0;
|
||||
color: #94a3b8;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.license-note {
|
||||
margin-top: 4px;
|
||||
font-size: 0.95rem;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.license-detail-list {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.host-list ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 8px 0 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.host-list li {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
font-size: 0.9rem;
|
||||
color: #64748b;
|
||||
}
|
||||
|
||||
.host-list li strong {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.license-links {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
margin-top: auto;
|
||||
}
|
||||
|
||||
.ghost-pill {
|
||||
border: 1px solid #cbd5f5;
|
||||
border-radius: 999px;
|
||||
padding: 4px 10px;
|
||||
font-size: 0.85rem;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.auth-card {
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.auth-tabs {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.auth-tab {
|
||||
flex: 1;
|
||||
border-radius: 999px;
|
||||
border: 1px solid #e2e8f0;
|
||||
background: #f8fafc;
|
||||
padding: 8px 12px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
color: #475569;
|
||||
}
|
||||
|
||||
.auth-tab.active {
|
||||
background: #eef2ff;
|
||||
border-color: #c7d2fe;
|
||||
color: #4338ca;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.app {
|
||||
padding: 40px 6vw 56px;
|
||||
@@ -241,6 +464,28 @@
|
||||
color: #e2e8f0;
|
||||
}
|
||||
|
||||
.site-nav {
|
||||
border-color: rgba(99, 102, 241, 0.4);
|
||||
}
|
||||
|
||||
.nav-link {
|
||||
color: #cbd5f5;
|
||||
}
|
||||
|
||||
.nav-link.active {
|
||||
background: rgba(79, 70, 229, 0.2);
|
||||
border-color: rgba(79, 70, 229, 0.4);
|
||||
color: #faf5ff;
|
||||
}
|
||||
|
||||
.nav-user {
|
||||
color: #cbd5f5;
|
||||
}
|
||||
|
||||
.nav-user-guest {
|
||||
color: #94a3b8;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: #cbd5f5;
|
||||
}
|
||||
@@ -277,6 +522,36 @@
|
||||
color: #e0e7ff;
|
||||
}
|
||||
|
||||
.auth-tab {
|
||||
border-color: #312e81;
|
||||
background: #1e1b4b;
|
||||
color: #cbd5f5;
|
||||
}
|
||||
|
||||
.auth-tab.active {
|
||||
background: rgba(79, 70, 229, 0.2);
|
||||
border-color: rgba(79, 70, 229, 0.6);
|
||||
color: #faf5ff;
|
||||
}
|
||||
|
||||
.hint,
|
||||
.license-meta-bar,
|
||||
.license-note {
|
||||
color: #cbd5f5;
|
||||
}
|
||||
|
||||
.field input,
|
||||
.field select,
|
||||
.field textarea {
|
||||
background: #1e1b4b;
|
||||
border-color: #312e81;
|
||||
color: #e2e8f0;
|
||||
}
|
||||
|
||||
.host-list li {
|
||||
color: #cbd5f5;
|
||||
}
|
||||
|
||||
.detail-list div {
|
||||
color: #cbd5f5;
|
||||
}
|
||||
@@ -300,7 +575,17 @@
|
||||
color: #fee2e2;
|
||||
}
|
||||
|
||||
.state.success {
|
||||
background: #14532d;
|
||||
color: #bbf7d0;
|
||||
}
|
||||
|
||||
.ghost-pill {
|
||||
border-color: #4f46e5;
|
||||
color: #cbd5f5;
|
||||
}
|
||||
|
||||
.footer {
|
||||
color: #94a3b8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user