diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..6ee957a
Binary files /dev/null and b/.DS_Store differ
diff --git a/.classpath b/.classpath
index fb26e58..ebb394e 100644
--- a/.classpath
+++ b/.classpath
@@ -8,7 +8,7 @@
-
-
+
+
diff --git a/ReadMe.rst b/ReadMe.rst
index f566654..50418ca 100644
--- a/ReadMe.rst
+++ b/ReadMe.rst
@@ -11,8 +11,11 @@
如果需要移动端的canvas功能,请参考canvas的前端文档。
+在进行此项目前,请您务必仔细阅读了:极验用户引导手册 [#geetest-user-guid]_
+.. [#geetest-user-guid] `极验用户必读 `__
+
核心SDK库
---------------------
@@ -58,6 +61,13 @@
#. 打开tomcat
#. 在浏览器中访问http://localhost:8080/gt-java-sdk/login.jsp即可看到Demo界面
+集成验证服务到自己项目
+=========================
+
+1. 将com.geetest.sdk.java这个包引入项目中
+#. 根据自身使用情况修改前端代码调用验证码,前端文档 http://www.geetest.com/install/sections/idx-client-sdk.html#web
+#. 修改后台代码,具体可以参考demo中的后台进行修改
+* 如果是web端使用,请把WebContent中的gt.js放到可以访问的地方,并将web端中引入gt.js的地方修改成存放gt.js的地址
failback效果展示
=========================
@@ -71,19 +81,38 @@ failback效果展示
failback效果
-----------------------
+----------------------
.. image:: ./2015-06-16-002.png
+
联系作者
=============
-QQ:1295351490
+QQ:383449573
发布日志(由新到旧)
-===================================
+==================================='
+
+3.3.0
+---------------------------
+- 修改demo的展现形式,增添一种mobile形式的验证码
+- demo后台增添mobile形式验证码的后台,mobile形式的验证码需要使用特定的id与key
+
+
+
+3.2.0
+---------------------------
+- 增加新接口,可以在两次验证过程中传入自定义userid,如果两次传入的userid不同,验证无法通过
+
+
+
+3.1.0
+---------------------------
+- 将注册完后获取的challenge进行一层加密再返回
+
3.0.1
diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml
index 02ec868..7cc3eed 100644
--- a/WebContent/WEB-INF/web.xml
+++ b/WebContent/WEB-INF/web.xml
@@ -15,54 +15,34 @@
com.geetest.sdk.java.web.demo.VerifyLoginServlet
-
-
-
-
- StartMsgCaptchaServlet
- StartMsgCaptchaServlet
-
- com.geetest.sdk.java.msg.demo.StartMsgCaptchaServlet
-
- VerifyGeetestServlet
- VerifyGeetestServlet
+ MobileStartCaptchaServlet
+ MobileStartCaptchaServlet
- com.geetest.sdk.java.msg.demo.VerifyGeetestServlet
+ com.geetest.sdk.java.web.mobiledemo.StartCaptchaServlet
- VerifyMsgServlet
- VerifyMsgServlet
+ MobileVerifyLoginServlet
+ MobileVerifyLoginServlet
- com.geetest.sdk.java.msg.demo.VerifyMsgServlet
+ com.geetest.sdk.java.web.mobiledemo.VerifyLoginServlet
-
-
-
VerifyLoginServlet
- /VerifyLoginServlet
+ /pc-geetest/validate
StartCaptchaServlet
- /StartCaptchaServlet
+ /pc-geetest/register
-
-
- StartMsgCaptchaServlet
- /StartMsgCaptchaServlet
+ MobileVerifyLoginServlet
+ /mobile-geetest/validate
- VerifyGeetestServlet
- /VerifyGeetestServlet
-
-
-
-
- VerifyMsgServlet
- /VerifyMsgServlet
+ MobileStartCaptchaServlet
+ /mobile-geetest/register
diff --git a/WebContent/gt.js b/WebContent/gt.js
new file mode 100644
index 0000000..7ec951e
--- /dev/null
+++ b/WebContent/gt.js
@@ -0,0 +1,276 @@
+/* initGeetest 1.0.0
+ * 用于加载id对应的验证码库,并支持宕机模式
+ * 暴露 initGeetest 进行验证码的初始化
+ * 一般不需要用户进行修改
+ */
+(function (global, factory) {
+ "use strict";
+ if (typeof module === "object" && typeof module.exports === "object") {
+ // CommonJS
+ module.exports = global.document ?
+ factory(global, true) :
+ function (w) {
+ if (!w.document) {
+ throw new Error("Geetest requires a window with a document");
+ }
+ return factory(w);
+ };
+ } else {
+ factory(global);
+ }
+})(typeof window !== "undefined" ? window : this, function (window, noGlobal) {
+ "use strict";
+ if (typeof window === 'undefined') {
+ throw new Error('Geetest requires browser environment');
+ }
+ var document = window.document;
+ var Math = window.Math;
+ var head = document.getElementsByTagName("head")[0];
+
+ function _Object(obj) {
+ this._obj = obj;
+ }
+
+ _Object.prototype = {
+ _each: function (process) {
+ var _obj = this._obj;
+ for (var k in _obj) {
+ if (_obj.hasOwnProperty(k)) {
+ process(k, _obj[k]);
+ }
+ }
+ return this;
+ }
+ };
+ function Config(config) {
+ var self = this;
+ new _Object(config)._each(function (key, value) {
+ self[key] = value;
+ });
+ }
+
+ Config.prototype = {
+ api_server: 'api.geetest.com',
+ protocol: 'http://',
+ type_path: '/gettype.php',
+ fallback_config: {
+ slide: {
+ static_servers: ["static.geetest.com", "dn-staticdown.qbox.me"],
+ type: 'slide',
+ slide: '/static/js/geetest.0.0.0.js'
+ },
+ fullpage: {
+ static_servers: ["static.geetest.com", "dn-staticdown.qbox.me"],
+ type: 'fullpage',
+ fullpage: '/static/js/fullpage.0.0.0.js'
+ }
+ },
+ _get_fallback_config: function () {
+ var self = this;
+ if (isString(self.type)) {
+ return self.fallback_config[self.type];
+ } else if (self.new_captcha) {
+ return self.fallback_config.fullpage;
+ } else {
+ return self.fallback_config.slide;
+ }
+ },
+ _extend: function (obj) {
+ var self = this;
+ new _Object(obj)._each(function (key, value) {
+ self[key] = value;
+ })
+ }
+ };
+ var isNumber = function (value) {
+ return (typeof value === 'number');
+ };
+ var isString = function (value) {
+ return (typeof value === 'string');
+ };
+ var isBoolean = function (value) {
+ return (typeof value === 'boolean');
+ };
+ var isObject = function (value) {
+ return (typeof value === 'object' && value !== null);
+ };
+ var isFunction = function (value) {
+ return (typeof value === 'function');
+ };
+ var callbacks = {};
+ var status = {};
+ var random = function () {
+ return parseInt(Math.random() * 10000) + (new Date()).valueOf();
+ };
+ var loadScript = function (url, cb) {
+ var script = document.createElement("script");
+ script.charset = "UTF-8";
+ script.async = true;
+ script.onerror = function () {
+ cb(true);
+ };
+ var loaded = false;
+ script.onload = script.onreadystatechange = function () {
+ if (!loaded &&
+ (!script.readyState ||
+ "loaded" === script.readyState ||
+ "complete" === script.readyState)) {
+
+ loaded = true;
+ setTimeout(function () {
+ cb(false);
+ }, 0);
+ }
+ };
+ script.src = url;
+ head.appendChild(script);
+ };
+ var normalizeDomain = function (domain) {
+ return domain.replace(/^https?:\/\/|\/$/g, '');
+ };
+ var normalizePath = function (path) {
+ path = path.replace(/\/+/g, '/');
+ if (path.indexOf('/') !== 0) {
+ path = '/' + path;
+ }
+ return path;
+ };
+ var normalizeQuery = function (query) {
+ if (!query) {
+ return '';
+ }
+ var q = '?';
+ new _Object(query)._each(function (key, value) {
+ if (isString(value) || isNumber(value) || isBoolean(value)) {
+ q = q + encodeURIComponent(key) + '=' + encodeURIComponent(value) + '&';
+ }
+ });
+ if (q === '?') {
+ q = '';
+ }
+ return q.replace(/&$/, '');
+ };
+ var makeURL = function (protocol, domain, path, query) {
+ domain = normalizeDomain(domain);
+
+ var url = normalizePath(path) + normalizeQuery(query);
+ if (domain) {
+ url = protocol + domain + url;
+ }
+
+ return url;
+ };
+ var load = function (protocol, domains, path, query, cb) {
+ var tryRequest = function (at) {
+
+ var url = makeURL(protocol, domains[at], path, query);
+ loadScript(url, function (err) {
+ if (err) {
+ if (at >= domains.length - 1) {
+ cb(true);
+ } else {
+ tryRequest(at + 1);
+ }
+ } else {
+ cb(false);
+ }
+ });
+ };
+ tryRequest(0);
+ };
+ var jsonp = function (domains, path, config, callback) {
+ if (isObject(config.getLib)) {
+ config._extend(config.getLib);
+ callback(config);
+ return;
+ }
+ if (config.offline) {
+ callback(config._get_fallback_config());
+ return;
+ }
+ var cb = "geetest_" + random();
+ window[cb] = function (data) {
+ if (data.status === 'success') {
+ callback(data.data);
+ } else if (!data.status) {
+ callback(data);
+ } else {
+ callback(config._get_fallback_config());
+ }
+ window[cb] = undefined;
+ try {
+ delete window[cb];
+ } catch (e) {
+ }
+ };
+ load(config.protocol, domains, path, {
+ gt: config.gt,
+ callback: cb
+ }, function (err) {
+ if (err) {
+ callback(config._get_fallback_config());
+ }
+ });
+ };
+ var throwError = function (errorType, config) {
+ var errors = {
+ networkError: '网络错误'
+ };
+ if (typeof config.onError === 'function') {
+ config.onError(errors[errorType]);
+ } else {
+ throw new Error(errors[errorType]);
+ }
+ };
+ var detect = function () {
+ return !!window.Geetest;
+ };
+ if (detect()) {
+ status.slide = "loaded";
+ }
+ var initGeetest = function (userConfig, callback) {
+ var config = new Config(userConfig);
+ if (userConfig.https) {
+ config.protocol = 'https://';
+ } else if (!userConfig.protocol) {
+ config.protocol = window.location.protocol + '//';
+ }
+ jsonp([config.api_server || config.apiserver], config.type_path, config, function (newConfig) {
+ var type = newConfig.type;
+ var init = function () {
+ config._extend(newConfig);
+ callback(new window.Geetest(config));
+ };
+ callbacks[type] = callbacks[type] || [];
+ var s = status[type] || 'init';
+ if (s === 'init') {
+ status[type] = 'loading';
+ callbacks[type].push(init);
+ load(config.protocol, newConfig.static_servers || newConfig.domains, newConfig[type] || newConfig.path, null, function (err) {
+ if (err) {
+ status[type] = 'fail';
+ throwError('networkError', config);
+ } else {
+ status[type] = 'loaded';
+ var cbs = callbacks[type];
+ for (var i = 0, len = cbs.length; i < len; i = i + 1) {
+ var cb = cbs[i];
+ if (isFunction(cb)) {
+ cb();
+ }
+ }
+ callbacks[type] = [];
+ }
+ });
+ } else if (s === "loaded") {
+ init();
+ } else if (s === "fail") {
+ throwError('networkError', config);
+ } else if (s === "loading") {
+ callbacks[type].push(init);
+ }
+ });
+ };
+ window.initGeetest = initGeetest;
+ return initGeetest;
+});
diff --git a/WebContent/login.jsp b/WebContent/login.jsp
index b3e5763..0afcb21 100644
--- a/WebContent/login.jsp
+++ b/WebContent/login.jsp
@@ -6,94 +6,293 @@
+ path + "/";
%>
-
+
-
-极意网络
-
-
-
-
-
-
-
-
-
-
+
+
+ gt-java-sdk-demo
+
-
+极验验证SDKDemo
+
+
+
+
+
+
+
+
-
-
JavaEE站点安装Demo页面
-
+
+
+
+
+
-
-
+
-
+