Browse Source

二次认证添加 &&安全模块整理

leijie 6 years ago
parent
commit
e3991644f6

+ 15 - 5
show-server/src/main/java/com/ai/ipu/show/bean/SceneBean.java

@ -1,20 +1,22 @@
1 1
package com.ai.ipu.show.bean;
2 2
3
import java.awt.image.BufferedImage;
4
import java.util.Random;
5
6
import org.apache.log4j.Logger;
7
8 3
import com.ai.ipu.server.util.MobileUtility;
9 4
import com.ai.ipu.show.core.bean.IpuAppBean;
10 5
import com.ai.ipu.show.core.context.IpuContextData;
11 6
import com.ai.ipu.show.core.session.IpuSessionManager;
12 7
import com.ai.ipu.show.util.ImageVerify;
8
import com.ai.ipu.show.util.safe.AuthGenerator;
13 9
import com.ailk.common.data.IData;
14 10
import com.ailk.common.data.impl.DataMap;
11
import org.apache.log4j.Logger;
12
13
import java.awt.image.BufferedImage;
14
import java.util.Random;
15 15
16 16
public class SceneBean extends IpuAppBean {
17 17
18
	private static final String key = "nkqbtjevrmnxofcwrgwq3xuwoj3tmwcj";//二次认证约定秘钥
19
18 20
	private static final Logger LOGGER = Logger.getLogger(SceneBean.class);
19 21
	
20 22
	/**
@ -236,4 +238,12 @@ public class SceneBean extends IpuAppBean {
236 238
		}
237 239
		return result;
238 240
	}
241
242
	public IData verifyCode(IData param){
243
		String code = param.getString("code");
244
		IData result = new DataMap();
245
		boolean isVerify = AuthGenerator.verify(key,code);
246
		result.put("result",isVerify);
247
		return result;
248
	}
239 249
}

+ 2 - 0
show-server/src/main/resources/server-data.xml

@ -11,4 +11,6 @@
11 11
12 12
	<!--测试请求-->
13 13
	<action name="SceneBean.dataRequestScene" class="com.ai.ipu.show.bean.SceneBean" method="dataRequestScene" verify="false"></action>
14
	<!-- 二次认证-->
15
	<action name="SceneBean.verifyCode" class="com.ai.ipu.show.bean.SceneBean" method="verifyCode" verify="false"></action>
14 16
</datas>

+ 6 - 2
show-server/src/main/resources/server-page.xml

@ -35,9 +35,13 @@
35 35
    <action name="LocalStorage" template="template/webapp/plugins/localStorage.html"></action>
36 36
    <action name="WDFImageCache" template="template/webapp/plugins/WDFImageCache.html"></action>
37 37
    <action name="ImageSave" template="template/webapp/plugins/image.html"></action>
38
    <action name="FingerprintUnlock" template="template/webapp/plugins/fingerprintUnlock.html"></action>
39 38
    <action name="DownloadFile" template="template/webapp/plugins/downloadFile.html"></action>
40
    
39
40
    <!-- 安全 -->
41
    <action name="Safe" template="template/webapp/plugins/safe/safe.html"></action>
42
    <action name="FingerprintUnlock" template="template/webapp/plugins/safe/fingerprintUnlock.html"></action>
43
    <action name="SecondVerify" template="template/webapp/plugins/safe/secondVerify.html"></action>
44
41 45
    <!-- JS组件 -->
42 46
    <action name="Carousel" template="template/webapp/jsComponent/carousel.html"></action>
43 47
    <action name="Refresh" 	template="template/webapp/jsComponent/refresh.html"></action>

show-server/src/main/webapp/biz/img/IPU logo_Display.png → show-server/src/main/webapp/biz/img/IPU_logo_Display.png


show-server/src/main/webapp/biz/js/plugins/fingerprintUnlock.js → show-server/src/main/webapp/biz/js/plugins/safe/fingerprintUnlock.js


+ 13 - 0
show-server/src/main/webapp/biz/js/plugins/safe/safe.js

@ -0,0 +1,13 @@
1
require(["wadeMobile","jcl","ipuUI",'mobile'],function(WadeMobile,$,ipuUI,Mobile){
2
    $('#toFinger').click(function(){
3
        Mobile.openPage('FingerprintUnlock');
4
    });
5
6
    $('#toSecondeVry').click(function () {
7
        Mobile.openPage('SecondVerify');
8
    });
9
10
    $('#toGesture').click(function () {
11
        alert("原生插件开发中...");
12
    });
13
});

+ 23 - 0
show-server/src/main/webapp/biz/js/plugins/safe/secondVerify.js

@ -0,0 +1,23 @@
1
require(["wadeMobile","jcl","common",'util'], function(WadeMobile,$,Common) {
2
3
    $('#createCode').click(function () {
4
        WadeMobile.createSecondVerify(function (result) {
5
            $('#verifyCodeDisplay').html(result);
6
        });
7
    });
8
    
9
    $('#sendVerifyCode').click(function () {
10
        var param = new Wade.DataMap();
11
        param.put("code",$.trim($("#verifyCodeInput").val()));
12
        Common.callSvc("SceneBean.verifyCode",param,function (resultData) {
13
            alert(resultData);
14
            if(typeof (resultData) == "string"){
15
                resultData = new Wade.DataMap(resultData);
16
            }
17
            var result = resultData.get("result");
18
            alert("认证结果为:" + result);
19
        },null,function (errData) {
20
            alert("插件调用异常信息:" + errData);
21
        });
22
    });
23
});

+ 6 - 2
show-server/src/main/webapp/ipu/frame/mobile/expand-mobile.js

@ -476,8 +476,12 @@ define(["require","jcl"],function(require,Wade) {
476 476
			},downloadFile:function(type,url,relPath,callback){
477 477
				storageCallback("downloadFile",callback);
478 478
				execute("downloadFile",[type,url,relPath]);
479
			}
480
			
479
			},createSecondVerify:function(callback) {
480
                storageCallback("createSecondVerify",callback);
481
                execute("createSecondVerify",[]);
482
            },authSecondVerify:function () {
483
484
            }
481 485
		};
482 486
	})();
483 487
	

+ 1 - 1
show-server/src/main/webapp/template/webapp/about/index-list.html

@ -1,6 +1,6 @@
1 1
<div class="ipu-flex-content">
2 2
	<div class="app-about-logo">
3
		<img src="biz/img/IPU logo_Display.png">
3
		<img src="biz/img/IPU_logo_Display.png">
4 4
		<p class="app-about-name">IPU秀</p>
5 5
		<p class="app-about-version">版本号:3.0.0</p>
6 6
	</div>

+ 2 - 2
show-server/src/main/webapp/template/webapp/plugins/index-list.html

@ -125,9 +125,9 @@
125 125
	        <p>保存图片</p>
126 126
	    </li>
127 127
128
	    <li data-action="FingerprintUnlock">
128
	    <li data-action="Safe">
129 129
	        <div class="ipu-icon mdi mdi-image-area-close"></div>
130
	        <p>指纹解锁</p>
130
	        <p>安全</p>
131 131
	    </li>
132 132
133 133
		<li data-action="DownloadFile">

+ 1 - 1
show-server/src/main/webapp/template/webapp/plugins/fingerprintUnlock.html

@ -3,7 +3,7 @@
3 3
<head>
4 4
	<title>指纹解锁</title>
5 5
	{%>template/common/Head.html%}
6
	<script type="text/javascript" src="biz/js/plugins/fingerprintUnlock.js"></script>
6
	<script type="text/javascript" src="biz/js/plugins/safe/fingerprintUnlock.js"></script>
7 7
</head>
8 8
<body>
9 9

+ 76 - 0
show-server/src/main/webapp/template/webapp/plugins/safe/safe.html

@ -0,0 +1,76 @@
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
    <meta charset="UTF-8">
5
    <title>安全</title>
6
    {%>template/common/Head.html%}
7
    <script src="biz/js/plugins/safe/safe.js"></script>
8
</head>
9
<body>
10
    <div class="ipu-flex-row ipu-flex-vertical">
11
        <div class="ipu-flex-col">
12
            <header class="ipu-toolbar">
13
                <a class="ipu-fn-left page-back" href="javascript:;">
14
                    <i class="ipu-icon mdi mdi-chevron-left"></i>
15
                </a>
16
                <h1 class="ipu-toolbar-title">界面跳转</h1>
17
            </header>
18
        </div>
19
20
        <div class="ipu-flex-col ipu-flex-col-auto">
21
            <div class="page-content">
22
                <div class="demo-item">
23
24
                    <div class="demo-title">指纹解锁</div>
25
                        <div class="ipu-list">
26
                            <ul>
27
                                <li class="ipu-list-item">
28
                                    <div class="ipu-list-item-inner">
29
                                        <div class="ipu-list-item-title">打开指纹解锁样例</div>
30
                                        <div class="ipu-list-item-after">
31
                                            <button class="ipu-btn ipu-btn-s" id="toFinger">点击</button>
32
                                        </div>
33
                                    </div>
34
                                </li>
35
                            </ul>
36
                        </div>
37
38
                    <div class="demo-title">二次验证</div>
39
                    <div class="ipu-list">
40
                        <ul>
41
                            <li class="ipu-list-item">
42
                                <div class="ipu-list-item-inner">
43
                                    <div class="ipu-list-item-title">打开二次验证样例</div>
44
                                    <div class="ipu-list-item-after">
45
                                        <button class="ipu-btn ipu-btn-s" id="toSecondeVry">点击</button>
46
                                    </div>
47
                                </div>
48
                            </li>
49
                        </ul>
50
                    </div>
51
52
                    <div class="demo-title">手势锁</div>
53
                    <div class="ipu-list">
54
                        <ul>
55
                            <li class="ipu-list-item">
56
                                <div class="ipu-list-item-inner">
57
                                    <div class="ipu-list-item-title">打开原生手势锁界面</div>
58
                                    <div class="ipu-list-item-after">
59
                                        <button class="ipu-btn ipu-btn-s" id="toGesture">点击</button>
60
                                    </div>
61
                                </div>
62
                            </li>
63
                        </ul>
64
                    </div>
65
66
67
                    </div>
68
                </div>
69
            </div>
70
71
72
        </div>
73
    </div>
74
75
</body>
76
</html>

+ 62 - 0
show-server/src/main/webapp/template/webapp/plugins/safe/secondVerify.html

@ -0,0 +1,62 @@
1
<!DOCTYPE html>
2
<html lang="en">
3
<head>
4
    <meta charset="UTF-8">
5
    <title>二次验证</title>
6
    {%>template/common/Head.html%}
7
    <script src="biz/js/plugins/safe/secondVerify.js"></script>
8
</head>
9
<body>
10
    <div class="ipu-flex-row ipu-flex-vertical">
11
        <div class="ipu-flex-col">
12
            <header class="ipu-toolbar">
13
                <a class="ipu-fn-left page-back" href="javascript:;">
14
                    <i class="ipu-icon mdi mdi-chevron-left"></i>
15
                </a>
16
                <h1 class="ipu-toolbar-title">二次认证</h1>
17
            </header>
18
        </div>
19
20
21
        <div class="ipu-flex-col ipu-flex-col-auto">
22
            <div class="page-content">
23
24
                <div class="demo-item">
25
                    <div class="demo-title">获取</div>
26
                    <div class="demo-body">
27
                    <div class="demo-content">
28
                        <div class="ipu-flex ipu-flex-middle">
29
                            <div class="ipu-flex-grow-0" id="verifyCodeDisplay">请生成</div>
30
                        </div>
31
                        <div class=" ipu-fn-m-t">
32
                            <button class="ipu-btn" id="createCode">点击生成</button>
33
                        </div>
34
                    </div>
35
                    </div>
36
                </div>
37
38
                <div class="demo-item">
39
                    <div class="demo-title">认证</div>
40
                    <div class="demo-body">
41
                        <div class=demo-content>
42
                            <div class="ipu-flex ipu-flex-middle">
43
                                <div class="ipu-flex-grow-0">输入认证码:</div>
44
                                <div class="ipu-flex-grow-1">
45
                                    <input type="text" class="search-input" id="verifyCodeInput"
46
                                            />
47
                                </div>
48
                            </div>
49
                            <div class=" ipu-fn-m-t">
50
                                <button class="ipu-btn" id="sendVerifyCode">进行认证</button>
51
                            </div>
52
                        </div>
53
                    </div>
54
                </div>
55
            </div>
56
        </div>
57
58
59
    </div>>
60
61
</body>
62
</html>