feat: add login authentication and certificate expiry notifications

- JWT-based login with ADMIN_USER/ADMIN_PASSWORD env config
- Login page with auth guard for Vue frontend
- Feishu bot webhook notification for expiring certificates
- SMTP email notification for expiring certificates
- Daily 8:00 AM cron for expiry checks
- Startup health check notification
This commit is contained in:
2026-07-23 16:25:02 +08:00
parent 1bb895fd67
commit 2d70a15307
17 changed files with 2813 additions and 66 deletions
+46 -3
View File
@@ -2,14 +2,57 @@ import { createRouter, createWebHistory } from 'vue-router'
import Dashboard from '../views/Dashboard.vue'
import CertList from '../views/CertList.vue'
import CertCreate from '../views/CertCreate.vue'
import Login from '../views/Login.vue'
import { isLoggedIn } from '../api'
const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/', name: 'Dashboard', component: Dashboard },
{ path: '/certificates', name: 'CertList', component: CertList },
{ path: '/create', name: 'CertCreate', component: CertCreate },
{
path: '/login',
name: 'Login',
component: Login,
meta: { requiresAuth: false },
},
{
path: '/',
name: 'Dashboard',
component: Dashboard,
meta: { requiresAuth: true },
},
{
path: '/certificates',
name: 'CertList',
component: CertList,
meta: { requiresAuth: true },
},
{
path: '/create',
name: 'CertCreate',
component: CertCreate,
meta: { requiresAuth: true },
},
],
})
// Navigation guard
router.beforeEach((to, _, next) => {
const requiresAuth = to.meta.requiresAuth !== false
if (requiresAuth) {
if (isLoggedIn()) {
next()
} else {
next({ name: 'Login', query: { redirect: to.fullPath } })
}
} else {
// If already logged in and going to login, redirect to dashboard
if (to.name === 'Login' && isLoggedIn()) {
next({ name: 'Dashboard' })
} else {
next()
}
}
})
export default router