mirror of
https://github.com/skyle1995/NetworkAuth.git
synced 2026-05-25 02:24:05 +08:00
Add a login verification code
Fix the site icon
This commit is contained in:
@@ -32,6 +32,9 @@ func RegisterAdminRoutes(mux *http.ServeMux) {
|
||||
// 退出登录(无需拦截,幂等清理)
|
||||
mux.HandleFunc("/admin/logout", adminctl.LogoutHandler)
|
||||
|
||||
// 验证码生成路由(无需认证)
|
||||
mux.HandleFunc("/admin/captcha", adminctl.CaptchaHandler)
|
||||
|
||||
// 后台布局页(需要管理员认证)
|
||||
mux.HandleFunc("/admin/layout", adminctl.AdminAuthRequired(adminctl.AdminLayoutHandler))
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
// RegisterRoutes 聚合注册所有路由
|
||||
func RegisterRoutes(mux *http.ServeMux) {
|
||||
registerStaticRoutes(mux)
|
||||
registerFaviconRoute(mux)
|
||||
RegisterHomeRoutes(mux)
|
||||
RegisterAdminRoutes(mux)
|
||||
|
||||
@@ -35,3 +36,11 @@ func registerStaticRoutes(mux *http.ServeMux) {
|
||||
log.Printf("初始化静态资源文件系统失败: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// registerFaviconRoute 注册favicon路由
|
||||
func registerFaviconRoute(mux *http.ServeMux) {
|
||||
// 将 /favicon.ico 重定向到 /assets/favicon.svg
|
||||
mux.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
|
||||
http.Redirect(w, r, "/assets/favicon.svg", http.StatusMovedPermanently)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user