mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 19:31:46 +08:00
feat: turing test before send code
Signed-off-by: Kininaru <shiftregister233@outlook.com> i18n i18n Signed-off-by: Kininaru <shiftregister233@outlook.com>
This commit is contained in:
@ -59,6 +59,14 @@ type Response struct {
|
||||
Data2 interface{} `json:"data2"`
|
||||
}
|
||||
|
||||
type HumanCheck struct {
|
||||
Type string `json:"type"`
|
||||
AppKey string `json:"appKey"`
|
||||
Scene string `json:"scene"`
|
||||
CaptchaId string `json:"captchaId"`
|
||||
CaptchaImage interface{} `json:"captchaImage"`
|
||||
}
|
||||
|
||||
// @Title Signup
|
||||
// @Description sign up a new user
|
||||
// @Param username formData string true "The username to sign up"
|
||||
@ -216,3 +224,17 @@ func (c *ApiController) UploadAvatar() {
|
||||
c.Data["json"] = resp
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
||||
func (c *ApiController) GetHumanCheck() {
|
||||
c.Data["json"] = HumanCheck{Type: "none"}
|
||||
|
||||
provider := object.GetDefaultHumanCheckProvider()
|
||||
if provider == nil {
|
||||
id, img := object.GetCaptcha()
|
||||
c.Data["json"] = HumanCheck{Type: "captcha", CaptchaId: id, CaptchaImage: img}
|
||||
c.ServeJSON()
|
||||
return
|
||||
}
|
||||
|
||||
c.ServeJSON()
|
||||
}
|
||||
|
Reference in New Issue
Block a user