Files
atom/modules/system/controller/captcha.go
2023-02-04 16:24:08 +08:00

32 lines
588 B
Go
Executable File

package controller
import (
"atom/providers/captcha"
"atom/providers/config"
"github.com/gin-gonic/gin"
)
type CaptchaController interface {
Show(*gin.Context) (*captcha.CaptchaResponse, error)
}
type captchaControllerImpl struct {
conf *config.Config
captcha *captcha.Captcha
}
func NewCaptchaController(
conf *config.Config,
captcha *captcha.Captcha,
) CaptchaController {
return &captchaControllerImpl{
conf: conf,
captcha: captcha,
}
}
func (c *captchaControllerImpl) Show(ctx *gin.Context) (*captcha.CaptchaResponse, error) {
return c.captcha.Generate()
}