fix: 解决密码过期仍能正常跳转的问题

This commit is contained in:
ssongliu 2023-03-11 17:51:42 +08:00 committed by ssongliu
parent 9d65d2f4d6
commit f24821abc8
9 changed files with 12 additions and 9 deletions

View File

@ -39,7 +39,7 @@ var AddTableHost = &gormigrate.Migration{
return err return err
} }
host := model.Host{ 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 { if err := tx.Create(&host).Error; err != nil {
return err return err

View File

@ -11,7 +11,7 @@ type AppRouter struct {
func (a *AppRouter) InitAppRouter(Router *gin.RouterGroup) { func (a *AppRouter) InitAppRouter(Router *gin.RouterGroup) {
appRouter := Router.Group("apps") 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 baseApi := v1.ApiGroupApp.BaseApi
{ {

View File

@ -11,7 +11,7 @@ type NginxRouter struct {
func (a *NginxRouter) InitNginxRouter(Router *gin.RouterGroup) { func (a *NginxRouter) InitNginxRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("openresty") 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 baseApi := v1.ApiGroupApp.BaseApi
{ {

View File

@ -9,13 +9,16 @@ import (
type SettingRouter struct{} type SettingRouter struct{}
func (s *SettingRouter) InitSettingRouter(Router *gin.RouterGroup) { func (s *SettingRouter) InitSettingRouter(Router *gin.RouterGroup) {
router := Router.Group("settings").
Use(middleware.JwtAuth()).
Use(middleware.SessionAuth())
settingRouter := Router.Group("settings"). settingRouter := Router.Group("settings").
Use(middleware.JwtAuth()). Use(middleware.JwtAuth()).
Use(middleware.SessionAuth()). Use(middleware.SessionAuth()).
Use(middleware.PasswordExpired()) Use(middleware.PasswordExpired())
baseApi := v1.ApiGroupApp.BaseApi baseApi := v1.ApiGroupApp.BaseApi
{ {
settingRouter.POST("/search", baseApi.GetSettingInfo) router.POST("/search", baseApi.GetSettingInfo)
settingRouter.GET("/search/available", baseApi.GetSystemAvailable) settingRouter.GET("/search/available", baseApi.GetSystemAvailable)
settingRouter.POST("/expired/handle", baseApi.HandlePasswordExpired) settingRouter.POST("/expired/handle", baseApi.HandlePasswordExpired)
settingRouter.POST("/update", baseApi.UpdateSetting) settingRouter.POST("/update", baseApi.UpdateSetting)

View File

@ -11,7 +11,7 @@ type WebsiteRouter struct {
func (a *WebsiteRouter) InitWebsiteRouter(Router *gin.RouterGroup) { func (a *WebsiteRouter) InitWebsiteRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("websites") 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 baseApi := v1.ApiGroupApp.BaseApi
{ {

View File

@ -11,7 +11,7 @@ type WebsiteAcmeAccountRouter struct {
func (a *WebsiteAcmeAccountRouter) InitWebsiteAcmeAccountRouter(Router *gin.RouterGroup) { func (a *WebsiteAcmeAccountRouter) InitWebsiteAcmeAccountRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("websites/acme") 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 baseApi := v1.ApiGroupApp.BaseApi
{ {

View File

@ -11,7 +11,7 @@ type WebsiteDnsAccountRouter struct {
func (a *WebsiteDnsAccountRouter) InitWebsiteDnsAccountRouter(Router *gin.RouterGroup) { func (a *WebsiteDnsAccountRouter) InitWebsiteDnsAccountRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("websites/dns") 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 baseApi := v1.ApiGroupApp.BaseApi
{ {

View File

@ -11,7 +11,7 @@ type WebsiteGroupRouter struct {
func (a *WebsiteGroupRouter) InitWebsiteGroupRouter(Router *gin.RouterGroup) { func (a *WebsiteGroupRouter) InitWebsiteGroupRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("websites/groups") 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 baseApi := v1.ApiGroupApp.BaseApi
{ {

View File

@ -11,7 +11,7 @@ type WebsiteSSLRouter struct {
func (a *WebsiteSSLRouter) InitWebsiteSSLRouter(Router *gin.RouterGroup) { func (a *WebsiteSSLRouter) InitWebsiteSSLRouter(Router *gin.RouterGroup) {
groupRouter := Router.Group("websites/ssl") 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 baseApi := v1.ApiGroupApp.BaseApi
{ {