- Rename module path from github.com/patbritton/sojorn-backend to gitlab.com/patrickbritton3/sojorn/go-backend - Updated 78 references across 41 files - Matches new GitLab repository structure
33 lines
841 B
Go
33 lines
841 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
"gitlab.com/patrickbritton3/sojorn/go-backend/internal/services"
|
|
)
|
|
|
|
func (h *AdminHandler) GetAltchaChallenge(c *gin.Context) {
|
|
altchaService := services.NewAltchaService(h.jwtSecret) // Use JWT secret as ALTCHA secret for now
|
|
|
|
challenge, err := altchaService.GenerateChallenge()
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to generate challenge"})
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, challenge)
|
|
}
|
|
|
|
func (h *AuthHandler) GetAltchaChallenge(c *gin.Context) {
|
|
altchaService := services.NewAltchaService(h.config.JWTSecret)
|
|
|
|
challenge, err := altchaService.GenerateChallenge()
|
|
if err != nil {
|
|
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to generate challenge"})
|
|
return
|
|
}
|
|
|
|
c.JSON(http.StatusOK, challenge)
|
|
}
|