2026-04-22 20:27:33 +08:00
|
|
|
import Router from '@koa/router'
|
|
|
|
|
import * as ctrl from '../controllers/auth'
|
|
|
|
|
|
|
|
|
|
// Public routes (no auth required)
|
|
|
|
|
export const authPublicRoutes = new Router()
|
|
|
|
|
authPublicRoutes.get('/api/auth/status', ctrl.authStatus)
|
|
|
|
|
authPublicRoutes.post('/api/auth/login', ctrl.login)
|
|
|
|
|
|
|
|
|
|
// Protected routes (auth required)
|
|
|
|
|
export const authProtectedRoutes = new Router()
|
|
|
|
|
authProtectedRoutes.post('/api/auth/setup', ctrl.setupPassword)
|
|
|
|
|
authProtectedRoutes.post('/api/auth/change-password', ctrl.changePassword)
|
|
|
|
|
authProtectedRoutes.post('/api/auth/change-username', ctrl.changeUsername)
|
|
|
|
|
authProtectedRoutes.delete('/api/auth/password', ctrl.removePassword)
|
2026-05-08 18:29:43 +08:00
|
|
|
authProtectedRoutes.get('/api/auth/locked-ips', ctrl.listLockedIps)
|
|
|
|
|
authProtectedRoutes.delete('/api/auth/locked-ips', ctrl.unlockIpHandler)
|