1. 介绍

提供简单的验证图片功能

2. 使用

使用在线initilizer工具生成的工程中默认提供此插件。

也可以通过以下方式在工程中添加

2.1. build.gradle文件

    implementation('org.yunchen.gb:gb-plugin-simplecaptcha:1.2.0')

2.2. application.yml文件

在application.yml文件中加入如下的配置,注意gb顶级项的合并

gb:
    simplecaptcha:
      fontSize: 30  #字体大小
      height: 200
      width: 200
      length: 6 # 验证码字数
      bottomPadding: 16 # 文字与底部的距离
      lineSpacing: 10 # 用于混淆文本的对角线之间的距离
      chars: ABCDEFGHIJKLMNOPQRSTUVWXYZ  # 文字的选取区间
      font: Serif # 字体
      storeInSession: true # 验证信息可选择存储与session或cookie中的一种

2.3. 增加requestmap访问控制

在Startup.groovy文件中,中增加一条requestmap记录,配置/simpleCaptcha地址的访问权限 注意添加在/**的访问配置前面

     new Requestmap(name:'simpleCaptcha管理',url: '/simpleCaptcha/**', configAttribute: 'permitAll').save(flush: true);

3. 功能描述

在themleaf3页面中使用

 <div class="col-md-6">
    <img th:src="${#httpServletRequest.contextPath}+'/simpleCaptcha/image'"/>
 </div>