From e7b3a5e891287b1291d2ac38f7c83d5d73bc7906 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期六, 08 十月 2022 08:49:01 +0800 Subject: [PATCH] 1 --- src/main/resources/templates/login.html | 33 +++++++++++++++++++++++++++++---- 1 files changed, 29 insertions(+), 4 deletions(-) diff --git a/src/main/resources/templates/login.html b/src/main/resources/templates/login.html index c87baf0..7072630 100644 --- a/src/main/resources/templates/login.html +++ b/src/main/resources/templates/login.html @@ -30,14 +30,14 @@ <!-- 鐢ㄦ埛鍚� --> <div class="loginid" style='width: 400px; margin-right: 50px; margin-top: 45px; border-bottom: 1px solid #fff;'> <label for="username"></label> - <input class="required" id="username" placeholder="璇疯緭鍏ョ敤鎴峰悕" size="25" tabindex="1" + <input class="required" id="username" placeholder="璇疯緭鍏ョ敤鎴峰悕" size="20" tabindex="1" type="text" accesskey="n" autocomplete="off" name="username" value="" /> </div> <!-- 瀵嗙爜 --> <section> <div class="loginpwd" style='width: 400px; margin-right: 20px; margin-top: 30px; border-bottom: 1px solid #fff;'> <label for="password"></label> - <input class="required" placeholder="璇疯緭鍏ュ瘑鐮�" type="password" id="password" size="25" tabindex="2" + <input class="required" placeholder="璇疯緭鍏ュ瘑鐮�" type="password" id="password" size="20" tabindex="2" accesskey="p" autocomplete="off" name="password" value="" /><span id="capslock-on" style="display: none;"> <i class="fa fa-exclamation-circle"></i> <span>CAPSLOCK key is turned on!</span> @@ -215,11 +215,21 @@ noIframe(); createCode(); autoResize(); + getPublicKey(); $(window).on("resize", autoResize); document.getElementById('username').focus(); } </script> <script> + function getPublicKey() { + $.get("getPublicKey", function (rs) { + if (rs && rs.code == 200) { + window.encrypt = new JSEncrypt(); + encrypt.setPublicKey(rs.result); + } + }); + } + function sysValidate() { // 楠岃瘉鐢ㄦ埛鍚嶄笌瀵嗙爜 var theUsername = document.getElementById("username").value; @@ -234,6 +244,12 @@ $("#password").focus(); return false; } + /*if (!isValid(thePassword)) { + $("#eMsg").html("鎻愮ず锛氬瘑鐮佷负8-20浣嶅寘鍚瓧姣嶃�佹暟瀛楀拰鐗规畩瀛楃锛�"); + $("#password").focus(); + return false; + }*/ + // 楠岃瘉楠岃瘉鐮� var inputCode = document.getElementById("inputCode").value; if (inputCode.length <= 0) { @@ -264,8 +280,8 @@ var service = getQueryStr("service"); var data = { - "uid": username, - "pwd": password + "uid": encrypt.encrypt(username), + "pwd": encrypt.encrypt(password) }; $.ajax({ @@ -335,6 +351,15 @@ sysLogin(); } } + + // 瀵嗙爜鏄惁鍚堣 + function isValid(pwd) { + if (pwd) { + var regex = new RegExp('^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![a-z0-9]+$)(?![a-z\W!@#$%^&*`~()\\-_+=,.?;<>]+$)(?![0-9\W!@#$%^&*`~()\\-_+=,.?;<>]+$)[a-zA-Z0-9\W!@#$%^&*`~()\\-_+=,.?;<>]{16,30}$'); + return regex.test(pwd) + } + return false; + } </script> </body> </html> -- Gitblit v1.9.3