From f24821abc867eead45d325a30d78f75af5b43da4 Mon Sep 17 00:00:00 2001 From: ssongliu Date: Sat, 11 Mar 2023 17:51:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E4=BB=8D=E8=83=BD=E6=AD=A3=E5=B8=B8=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/init/migration/migrations/init.go | 2 +- backend/router/ro_app.go | 2 +- backend/router/ro_nginx.go | 2 +- backend/router/ro_setting.go | 5 ++++- backend/router/ro_website.go | 2 +- backend/router/ro_website_acme_account.go | 2 +- backend/router/ro_website_dns_account.go | 2 +- backend/router/ro_website_group.go | 2 +- backend/router/ro_website_ssl.go | 2 +- 9 files changed, 12 insertions(+), 9 deletions(-) diff --git a/backend/init/migration/migrations/init.go b/backend/init/migration/migrations/init.go index dec649f4c..6a969691e 100644 --- a/backend/init/migration/migrations/init.go +++ b/backend/init/migration/migrations/init.go @@ -39,7 +39,7 @@ var AddTableHost = &gormigrate.Migration{ return err } host := model.Host{ - Name: "localhost", Addr: "127.0.0.1", User: "root", Port: 22, GroupID: group.ID, + Name: "localhost", Addr: "127.0.0.1", User: "root", Port: 22, AuthMode: "password", GroupID: group.ID, } if err := tx.Create(&host).Error; err != nil { return err diff --git a/backend/router/ro_app.go b/backend/router/ro_app.go index ac9ffa1bc..fa87527c9 100644 --- a/backend/router/ro_app.go +++ b/backend/router/ro_app.go @@ -11,7 +11,7 @@ type AppRouter struct { func (a *AppRouter) InitAppRouter(Router *gin.RouterGroup) { appRouter := Router.Group("apps") - appRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()) + appRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) baseApi := v1.ApiGroupApp.BaseApi { diff --git a/backend/router/ro_nginx.go b/backend/router/ro_nginx.go index 94012ada7..bd33614c3 100644 --- a/backend/router/ro_nginx.go +++ b/backend/router/ro_nginx.go @@ -11,7 +11,7 @@ type NginxRouter struct { func (a *NginxRouter) InitNginxRouter(Router *gin.RouterGroup) { groupRouter := Router.Group("openresty") - groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()) + groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) baseApi := v1.ApiGroupApp.BaseApi { diff --git a/backend/router/ro_setting.go b/backend/router/ro_setting.go index 373da39c3..c06df62f8 100644 --- a/backend/router/ro_setting.go +++ b/backend/router/ro_setting.go @@ -9,13 +9,16 @@ import ( type SettingRouter struct{} func (s *SettingRouter) InitSettingRouter(Router *gin.RouterGroup) { + router := Router.Group("settings"). + Use(middleware.JwtAuth()). + Use(middleware.SessionAuth()) settingRouter := Router.Group("settings"). Use(middleware.JwtAuth()). Use(middleware.SessionAuth()). Use(middleware.PasswordExpired()) baseApi := v1.ApiGroupApp.BaseApi { - settingRouter.POST("/search", baseApi.GetSettingInfo) + router.POST("/search", baseApi.GetSettingInfo) settingRouter.GET("/search/available", baseApi.GetSystemAvailable) settingRouter.POST("/expired/handle", baseApi.HandlePasswordExpired) settingRouter.POST("/update", baseApi.UpdateSetting) diff --git a/backend/router/ro_website.go b/backend/router/ro_website.go index 75faf9927..079b5eaed 100644 --- a/backend/router/ro_website.go +++ b/backend/router/ro_website.go @@ -11,7 +11,7 @@ type WebsiteRouter struct { func (a *WebsiteRouter) InitWebsiteRouter(Router *gin.RouterGroup) { groupRouter := Router.Group("websites") - groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()) + groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) baseApi := v1.ApiGroupApp.BaseApi { diff --git a/backend/router/ro_website_acme_account.go b/backend/router/ro_website_acme_account.go index 3d36e519b..4eaeee04b 100644 --- a/backend/router/ro_website_acme_account.go +++ b/backend/router/ro_website_acme_account.go @@ -11,7 +11,7 @@ type WebsiteAcmeAccountRouter struct { func (a *WebsiteAcmeAccountRouter) InitWebsiteAcmeAccountRouter(Router *gin.RouterGroup) { groupRouter := Router.Group("websites/acme") - groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()) + groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) baseApi := v1.ApiGroupApp.BaseApi { diff --git a/backend/router/ro_website_dns_account.go b/backend/router/ro_website_dns_account.go index cf4172614..d9dcb0617 100644 --- a/backend/router/ro_website_dns_account.go +++ b/backend/router/ro_website_dns_account.go @@ -11,7 +11,7 @@ type WebsiteDnsAccountRouter struct { func (a *WebsiteDnsAccountRouter) InitWebsiteDnsAccountRouter(Router *gin.RouterGroup) { groupRouter := Router.Group("websites/dns") - groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()) + groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) baseApi := v1.ApiGroupApp.BaseApi { diff --git a/backend/router/ro_website_group.go b/backend/router/ro_website_group.go index ff9524ab5..b2f548010 100644 --- a/backend/router/ro_website_group.go +++ b/backend/router/ro_website_group.go @@ -11,7 +11,7 @@ type WebsiteGroupRouter struct { func (a *WebsiteGroupRouter) InitWebsiteGroupRouter(Router *gin.RouterGroup) { groupRouter := Router.Group("websites/groups") - groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()) + groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) baseApi := v1.ApiGroupApp.BaseApi { diff --git a/backend/router/ro_website_ssl.go b/backend/router/ro_website_ssl.go index b13626af2..a70701212 100644 --- a/backend/router/ro_website_ssl.go +++ b/backend/router/ro_website_ssl.go @@ -11,7 +11,7 @@ type WebsiteSSLRouter struct { func (a *WebsiteSSLRouter) InitWebsiteSSLRouter(Router *gin.RouterGroup) { groupRouter := Router.Group("websites/ssl") - groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()) + groupRouter.Use(middleware.JwtAuth()).Use(middleware.SessionAuth()).Use(middleware.PasswordExpired()) baseApi := v1.ApiGroupApp.BaseApi {