Add verify password endpoint

This commit is contained in:
Neeraj Gupta
2025-07-18 15:58:40 +05:30
parent 02b93b12fc
commit eb8737cb46
2 changed files with 16 additions and 0 deletions

View File

@@ -600,6 +600,7 @@ func main() {
fileLinkApi.GET("/info", fileHandler.LinkInfo)
fileLinkApi.GET("/thumbnail", fileHandler.LinkThumbnail)
fileLinkApi.GET("/file", fileHandler.LinkFile)
fileLinkApi.POST("/verify-password", fileHandler.VerifyPassword)
publicCollectionAPI.GET("/files/preview/:fileID", publicCollectionHandler.GetThumbnail)
publicCollectionAPI.GET("/files/download/:fileID", publicCollectionHandler.GetFile)

View File

@@ -88,6 +88,21 @@ func (h *FileHandler) GetUrls(c *gin.Context) {
})
}
// VerifyPassword verifies the password for given public access token and return signed jwt token if it's valid
func (h *FileHandler) VerifyPassword(c *gin.Context) {
var req ente.VerifyPasswordRequest
if err := c.ShouldBindJSON(&req); err != nil {
handler.Error(c, stacktrace.Propagate(err, ""))
return
}
resp, err := h.FileUrlCtrl.VerifyPassword(c, req)
if err != nil {
handler.Error(c, stacktrace.Propagate(err, ""))
return
}
c.JSON(http.StatusOK, resp)
}
// UpdateFileURL updates the share URL for a file
func (h *FileHandler) UpdateFileURL(c *gin.Context) {
var req ente.UpdateFileUrl