feat: add simple ALTCHA challenge endpoints

- Add GetAltchaChallenge method to both auth and admin handlers
- Simple implementation returning test challenge data
- This should fix the route registration issue
This commit is contained in:
Patrick Britton 2026-02-16 23:11:54 -06:00
parent fcdecacb01
commit b6909ffc67
2 changed files with 23 additions and 0 deletions

View file

@ -4128,3 +4128,14 @@ func (h *AdminHandler) SendTestEmail(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "Test email sent to " + req.ToEmail}) c.JSON(http.StatusOK, gin.H{"message": "Test email sent to " + req.ToEmail})
} }
func (h *AdminHandler) GetAltchaChallenge(c *gin.Context) {
// Simple ALTCHA challenge implementation
challenge := map[string]interface{}{
"algorithm": "SHA-256",
"challenge": fmt.Sprintf("%d", time.Now().UnixNano()),
"salt": fmt.Sprintf("%d", time.Now().Unix()),
"signature": "test-signature",
}
c.JSON(http.StatusOK, challenge)
}

View file

@ -5,6 +5,7 @@ import (
"crypto/sha256" "crypto/sha256"
"encoding/base64" "encoding/base64"
"encoding/hex" "encoding/hex"
"fmt"
"net/http" "net/http"
"time" "time"
@ -595,3 +596,14 @@ func (h *AuthHandler) ResetPassword(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{"message": "Password reset successfully"}) c.JSON(http.StatusOK, gin.H{"message": "Password reset successfully"})
} }
func (h *AuthHandler) GetAltchaChallenge(c *gin.Context) {
// Simple ALTCHA challenge implementation
challenge := map[string]interface{}{
"algorithm": "SHA-256",
"challenge": fmt.Sprintf("%d", time.Now().UnixNano()),
"salt": fmt.Sprintf("%d", time.Now().Unix()),
"signature": "test-signature",
}
c.JSON(http.StatusOK, challenge)
}