feat: Update storage provider form and validation enhancements

- Added new HTML elements and JavaScript functionality to improve the user experience for WebDAV and Hetzner storage providers.
- Updated form field descriptions and placeholders for clarity, ensuring users understand the required input.
- Enhanced validation logic for WebDAV to ensure the host includes the protocol.
- Improved logging for debugging during form submissions, particularly for WebDAV credentials.
- Removed the deprecated provider form component to streamline the codebase.
This commit is contained in:
StarFleetCPTN committed 2025-04-18 03:54:48 -07:00
1 parent dc665b9fa4
commit b819162732
6 files changed
+314 -200

No files matched your search

@@ -2,6 +2,7 @@ package handlers
import (
"fmt"
"log"
"net/http"
"strconv"
"strings"
@@ -446,6 +447,19 @@ func (h *Handlers) parseProviderFromForm(c *gin.Context) (db.StorageProvider, er
provider.Username = c.PostForm("username")
provider.Password = c.PostForm("password")
// Log for debugging
log.Printf("WebDAV provider: username=%s, password present=%v",
provider.Username, provider.Password != "")
// WebDAV uses Host without port (full URL)
if provider.Host == "" {
return provider, fmt.Errorf("host/URL is required for WebDAV provider")
}
if provider.Username == "" {
return provider, fmt.Errorf("username is required for WebDAV provider")
}
case db.ProviderTypeS3, db.ProviderTypeWasabi, db.ProviderTypeMinio, db.ProviderTypeB2:
// S3 specific fields
provider.AccessKey = c.PostForm("accessKey")