其他分享
首页 > 其他分享> > 验证码工具-happy-captcha

验证码工具-happy-captcha

作者:互联网

<dependency>
            <groupId>com.ramostear</groupId>
            <artifactId>Happy-Captcha</artifactId>
            <version>1.0.1</version>
        </dependency>
@RestController
@RequestMapping("/happy-captcha")
public class HappyCaptchaController {
    @GetMapping("/generator")
    @TokenCheck(required = false)
    public void generatorCode(HttpServletRequest request, HttpServletResponse response){
        HappyCaptcha.require(request, response)
                .style(CaptchaStyle.ANIM)//设置动画
                .type(CaptchaType.ARITHMETIC_ZH)//设置算数验证码
                .build().finish();
    }
    @GetMapping("/verify")
    @TokenCheck(required = false)
    public String verify(String verifyCode,HttpServletRequest request){
        Boolean aBoolean=HappyCaptcha.verification(request, verifyCode,true);
        if(aBoolean){
            HappyCaptcha.remove(request);
            return "通过";
        }
        return "不通过";
    }
}

----------------------------

<dependency>
    <groupId>com.github.whvcse</groupId>
    <artifactId>easy-captcha</artifactId>
    <version>1.6.2</version>
</dependency>

 

标签:return,HappyCaptcha,request,验证码,captcha,aBoolean,public,happy
来源: https://www.cnblogs.com/Lcch/p/16245065.html