From f4018ed0a1809c9d89703784329aa621df4d43b0 Mon Sep 17 00:00:00 2001 From: "Zhendi.Wang" Date: Thu, 26 Sep 2024 20:54:27 +0800 Subject: [PATCH 1/2] check user exists when visit dataset and space detail (#689) --- internal/middleware/auth_middleware.go | 2 +- internal/routes/spaces.go | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/middleware/auth_middleware.go b/internal/middleware/auth_middleware.go index 4ee765715..957cdb2c9 100644 --- a/internal/middleware/auth_middleware.go +++ b/internal/middleware/auth_middleware.go @@ -32,7 +32,7 @@ func CheckCurrentUser() gin.HandlerFunc { return func(ctx *gin.Context) { currentUser := jwt.GetCurrentUser(ctx) if currentUser == nil { - ctx.Redirect(http.StatusFound, "/errors/unauthorized") + ctx.Redirect(http.StatusFound, "/login") ctx.Abort() return } diff --git a/internal/routes/spaces.go b/internal/routes/spaces.go index fcd56cb4e..d07518444 100644 --- a/internal/routes/spaces.go +++ b/internal/routes/spaces.go @@ -11,12 +11,6 @@ func registerSpaceRoutes(engine *gin.Engine, handlers *HandlersRegistry) { spaceRoutes := engine.Group("/spaces") { spaceRoutes.GET("", spaceHandler.List) - spaceRoutes.GET("/:namespace/:space_name", spaceHandler.Detail) - spaceRoutes.GET("/:namespace/:space_name/files/:branch/*path", spaceHandler.Files) - spaceRoutes.GET("/:namespace/:space_name/blob/:branch/*path", spaceHandler.Blob) - spaceRoutes.GET("/:namespace/:space_name/commits", spaceHandler.Commits) - spaceRoutes.GET("/:namespace/:space_name/commit/:commit_id", spaceHandler.Commit) - spaceRoutes.GET("/:namespace/:space_name/community", spaceHandler.Community) } authenticatedRoutes := spaceRoutes.Group("") @@ -28,5 +22,11 @@ func registerSpaceRoutes(engine *gin.Engine, handlers *HandlersRegistry) { authenticatedRoutes.GET("/:namespace/:space_name/edit/:branch/:path", spaceHandler.EditFile) authenticatedRoutes.GET("/:namespace/:space_name/settings", spaceHandler.Settings) authenticatedRoutes.GET("/:namespace/:space_name/billing", spaceHandler.Billing) + authenticatedRoutes.GET("/:namespace/:space_name", spaceHandler.Detail) + authenticatedRoutes.GET("/:namespace/:space_name/files/:branch/*path", spaceHandler.Files) + authenticatedRoutes.GET("/:namespace/:space_name/blob/:branch/*path", spaceHandler.Blob) + authenticatedRoutes.GET("/:namespace/:space_name/commits", spaceHandler.Commits) + authenticatedRoutes.GET("/:namespace/:space_name/commit/:commit_id", spaceHandler.Commit) + authenticatedRoutes.GET("/:namespace/:space_name/community", spaceHandler.Community) } } From 07609ea8ffc7973135997706120f979017588341 Mon Sep 17 00:00:00 2001 From: Hiveer Date: Thu, 26 Sep 2024 21:21:50 +0800 Subject: [PATCH 2/2] Fix typo (#691) --- frontend/src/locales/en_js/navbar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/locales/en_js/navbar.js b/frontend/src/locales/en_js/navbar.js index 0938fae81..43c9f4f38 100644 --- a/frontend/src/locales/en_js/navbar.js +++ b/frontend/src/locales/en_js/navbar.js @@ -13,7 +13,7 @@ export const navbar = { newOrganization: "New Organization", logout: "Logout", register: "Register", - loginRegister: "Login/Registe", + loginRegister: "Login/Register", login: "Login", newCollection: "New Collection", emailMissing: 'Please provide your email address before proceeding',