|
@@ -1,5 +1,7 @@
|
|
package cn.com.qmth.examcloud.core.basic.starter;
|
|
package cn.com.qmth.examcloud.core.basic.starter;
|
|
|
|
|
|
|
|
+import java.util.Properties;
|
|
|
|
+
|
|
import org.slf4j.MDC;
|
|
import org.slf4j.MDC;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
@@ -25,6 +27,8 @@ import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
|
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
|
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
|
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
+import com.google.code.kaptcha.impl.DefaultKaptcha;
|
|
|
|
+import com.google.code.kaptcha.util.Config;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLog;
|
|
import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLog;
|
|
import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLogFactory;
|
|
import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLogFactory;
|
|
@@ -106,4 +110,24 @@ public class CoreBasicApp {
|
|
resolver.setMaxUploadSize(200 * 1024 * 1024);
|
|
resolver.setMaxUploadSize(200 * 1024 * 1024);
|
|
return resolver;
|
|
return resolver;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Bean
|
|
|
|
+ public DefaultKaptcha getDefaultKaptcha() {
|
|
|
|
+ DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
|
|
|
|
+ Properties properties = new Properties();
|
|
|
|
+ properties.setProperty("kaptcha.border", "yes");
|
|
|
|
+ properties.setProperty("kaptcha.border.color", "105,179,90");
|
|
|
|
+ properties.setProperty("kaptcha.textproducer.font.color", "blue");
|
|
|
|
+ properties.setProperty("kaptcha.image.width", "110");
|
|
|
|
+ properties.setProperty("kaptcha.image.height", "40");
|
|
|
|
+ properties.setProperty("kaptcha.textproducer.font.size", "30");
|
|
|
|
+ properties.setProperty("kaptcha.session.key", "code");
|
|
|
|
+ properties.setProperty("kaptcha.textproducer.char.length", "4");
|
|
|
|
+ properties.setProperty("kaptcha.textproducer.font.names", "宋体,楷体,微软雅黑");
|
|
|
|
+ Config config = new Config(properties);
|
|
|
|
+ defaultKaptcha.setConfig(config);
|
|
|
|
+
|
|
|
|
+ return defaultKaptcha;
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|