diff --git a/web/controller/index.go b/web/controller/index.go
index dd58e5e5..be289a68 100644
--- a/web/controller/index.go
+++ b/web/controller/index.go
@@ -44,6 +44,7 @@ func (a *IndexController) initRouter(g *gin.RouterGroup) {
g.POST("/login", a.login)
g.POST("/getTwoFactorEnable", a.getTwoFactorEnable)
+ g.POST("/getTurnstileSiteKey", a.getTurnstileSiteKey)
}
// index handles the root route, redirecting logged-in users to the panel or showing the login page.
@@ -131,3 +132,11 @@ func (a *IndexController) getTwoFactorEnable(c *gin.Context) {
jsonObj(c, status, nil)
}
}
+
+// getTurnstileSiteKey returns the Cloudflare Turnstile site key for the registration form.
+func (a *IndexController) getTurnstileSiteKey(c *gin.Context) {
+ siteKey, err := a.settingService.GetTurnstileSiteKey()
+ if err == nil {
+ jsonObj(c, siteKey, nil)
+ }
+}
diff --git a/web/entity/entity.go b/web/entity/entity.go
index 40294925..90710f88 100644
--- a/web/entity/entity.go
+++ b/web/entity/entity.go
@@ -103,7 +103,9 @@ type AllSetting struct {
LdapDefaultTotalGB int `json:"ldapDefaultTotalGB" form:"ldapDefaultTotalGB"`
LdapDefaultExpiryDays int `json:"ldapDefaultExpiryDays" form:"ldapDefaultExpiryDays"`
LdapDefaultLimitIP int `json:"ldapDefaultLimitIP" form:"ldapDefaultLimitIP"`
- // JSON subscription routing rules
+
+ // Registration settings
+ TurnstileSiteKey string `json:"turnstileSiteKey" form:"turnstileSiteKey"`
}
// CheckValid validates all settings in the AllSetting struct, checking IP addresses, ports, SSL certificates, and other configuration values.
diff --git a/web/html/login.html b/web/html/login.html
index 6d98e6b1..69bc2142 100644
--- a/web/html/login.html
+++ b/web/html/login.html
@@ -59,39 +59,83 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- [[ loadingStates.spinning ? '' : '{{ i18n "login" }}' ]]
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ loadingStates.spinning ? '' : '{{ i18n "login" }}' ]]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ loadingStates.registerSpinning ? '' : '{{ i18n "pages.login.registerTab" }}' ]]
+
+
+
+
+
+
+
+
@@ -103,23 +147,39 @@
{{template "page/body_scripts" .}}
{{template "component/aThemeSwitch" .}}