find_password1.ftl 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>${(systemInfo.systemTitle)!}-找回密码</title>
  7. <link href="/login/css/bootstrap.min.css" rel="stylesheet">
  8. <link href="/login/css/font-awesome.css" rel="stylesheet">
  9. <link href="/login/css/animate.css" rel="stylesheet">
  10. <link href="/login/css/style.css" rel="stylesheet">
  11. <link href="/login/css/find-password.css" rel="stylesheet">
  12. <#--<#include "/common/link.template">-->
  13. </head>
  14. <body style="background-color:#FEFEFE;padding-bottom: 0">
  15. <#include "/login/find_password_top.ftl">
  16. <div class="content">
  17. <div class="web-width">
  18. <div class="for-liucheng">
  19. <div class="liulist for-cur"></div>
  20. <div class="liulist"></div>
  21. <div class="liulist"></div>
  22. <div class="liulist"></div>
  23. <div class="liutextbox">
  24. <div class="liutext for-cur"><em>1</em><br/><strong>填写账户名</strong></div>
  25. <div class="liutext"><em>2</em><br/><strong>验证身份</strong></div>
  26. <div class="liutext"><em>3</em><br/><strong>设置新密码</strong></div>
  27. <div class="liutext"><em>4</em><br/><strong>完成</strong></div>
  28. </div>
  29. </div>
  30. <div class="col-md-5" style="margin-left: 400px">
  31. <div class="ibox-content">
  32. <p>&nbsp;</p>
  33. <h1>填写账户名</h1>
  34. <form class="m-t" role="form" id="form" action="/findPwd/findPwd2" method="post"
  35. onsubmit="return checkSearchForm();">
  36. <div class="form-group has-feedback" style="display: inline-block;width: 300px">
  37. <#-- <label>用户名</label>-->
  38. <input type="text" id="username" name="username" <#--onblur="checkIsExistUser()"-->
  39. class="form-control" placeholder="用户名" required="" style="display: inline-block">
  40. </input>
  41. <span class="glyphicon glyphicon-user form-control-feedback"></span>
  42. </div>
  43. <div id="msg" style="color: red;display: inline-block">${msg!}</div>
  44. <#if (systemInfo.verCode)?? && systemInfo.verCode == "true">
  45. <#if (systemInfo.slide)?? && systemInfo.slide == "true">
  46. <div class="form-group">
  47. <div id="embed-captcha"></div>
  48. <p id="wait" class="show">正在加载验证码......</p>
  49. <p id="notice" style="color: #ff0000" class="hide">请先拖动验证码到相应位置</p>
  50. </div>
  51. </#if>
  52. <#if (systemInfo.slide)?? && systemInfo.slide == "false">
  53. <div class="form-group">
  54. <input type="text" name="verCode" onkeyup="verCodeText(this)" oninput="verCodeText(this)"
  55. maxlength="4" style="width: 60%;display: initial;" class="form-control"
  56. placeholder="验证码">
  57. <img id="verCodeId" src="" alt="" title="看不清换一张" onclick="getVerCode()"
  58. style="vertical-align:middle;"/>
  59. <span id="isvercodeimg"></span>
  60. <input type="hidden" id="idvercode">
  61. </div>
  62. </#if>
  63. </#if>
  64. <button type="button" id="submitBtn" class="btn btn-primary block m-b "
  65. onclick="checkIsExistUser()" style="width: 85px;margin-left: 108px;">提交
  66. </button>
  67. </form>
  68. </div>
  69. </div>
  70. </div>
  71. </div>
  72. <!-- Mainly scripts -->
  73. <script src="/login/js/jquery-2.1.1.js"></script>
  74. <#if (systemInfo.slide)?? && systemInfo.slide == "true">
  75. <script src="/login/js/gt.js"></script>
  76. </#if>
  77. <script>
  78. $(function () {
  79. <#if (systemInfo.verCode)?? && systemInfo.verCode == "true">
  80. <#if (systemInfo.slide)?? && systemInfo.slide == "true">
  81. // 滑动图片验证码
  82. verCodeImg();
  83. </#if>
  84. <#if (systemInfo.slide)?? && systemInfo.slide == "false">
  85. // 验证码图片
  86. getVerCode();
  87. </#if>
  88. </#if>
  89. });
  90. <#if (systemInfo.verCode)?? && systemInfo.verCode == "true">
  91. <#if (systemInfo.slide)?? && systemInfo.slide == "false">
  92. //验证码校验
  93. function verCodeText(dom){
  94. $("#isvercodeimg").html("");//验证码验证图片清除
  95. var verCode = $(dom).val()||"";
  96. //只能输入字母和数字
  97. $(dom).val(verCode.replace(/[^0-9a-zA-Z]/g,''));
  98. verCode = $(dom).val()||"";
  99. if(verCode.length > 4){
  100. verCode = verCode.substring(0,4);
  101. $(dom).val(verCode);
  102. }
  103. if(verCode.length == 4){
  104. isVerCode(verCode);
  105. }
  106. }
  107. //获得验证码
  108. function getVerCode(){
  109. $.ajax({
  110. type: "post",
  111. async: false, //同步执行
  112. url: "verCode",
  113. dataType: "json", //返回数据形式为json
  114. success: function(result) {
  115. //if (result.success) {
  116. $("#verCodeId").attr("src","data:image/png;base64,"+result.verCode);
  117. $("input[name='verCode']").val("");//验证码清空
  118. $("#isvercodeimg").html("");//验证码验证图片清除
  119. //}
  120. }
  121. });
  122. }
  123. //即时校验验证码
  124. function isVerCode(verCode){
  125. $.ajax({
  126. type: "post",
  127. async: false, //同步执行
  128. url: "isVerCode?verCode="+verCode,
  129. dataType: "json", //返回数据形式为json
  130. success: function(result) {
  131. if (result.success) {
  132. $("#idvercode").val("yes");
  133. $("#isvercodeimg").html("<img src='login/images/ok.png'/>");
  134. }else{
  135. $("#idvercode").val("");
  136. $("#isvercodeimg").html("<img src='login/images/cancel.png'/>");
  137. }
  138. }
  139. });
  140. }
  141. </#if>
  142. <#if (systemInfo.slide)?? && systemInfo.slide == "true">
  143. // 滑动图片验证码
  144. function verCodeImg(){
  145. var handlerEmbed = function (captchaObj) {
  146. $("#submit").click(function (e) {
  147. var validate = captchaObj.getValidate();
  148. if (!validate) {
  149. // $("#notice")[0].className = "show";
  150. $("#msg").html($("#notice").html()).show();
  151. setTimeout(function () {
  152. $("#msg").hide();
  153. // $("#notice")[0].className = "hide";
  154. }, 2000);
  155. e.preventDefault();
  156. }
  157. });
  158. // 将验证码加到id为captcha的元素里
  159. captchaObj.appendTo("#embed-captcha");
  160. captchaObj.onReady(function () {
  161. $("#wait")[0].className = "hide";
  162. });
  163. // 更多接口参考:http://www.geetest.com/install/sections/idx-client-sdk.html
  164. };
  165. $.ajax({
  166. // 获取id,challenge,success(是否启用failback)
  167. url: "verCodeImg",
  168. type: "get",
  169. dataType: "json",
  170. success: function (data) {
  171. // 使用initGeetest接口
  172. // 参数1:配置参数
  173. // 参数2:回调,回调的第一个参数验证码对象,之后可以使用它做appendTo之类的事件
  174. initGeetest({
  175. gt: data.gt,
  176. challenge: data.challenge,
  177. width: "100%",
  178. product: "popup", // 产品形式,包括:float,embed,popup。注意只对PC版验证码有效
  179. offline: !data.success // 表示用户后台检测极验服务器是否宕机,一般不需要关注
  180. }, handlerEmbed);
  181. }
  182. });
  183. }
  184. </#if>
  185. </#if>
  186. //登录信息校验
  187. function checkSearchForm() {
  188. <#if (systemInfo.verCode)?? && systemInfo.verCode == "true">
  189. <#if (systemInfo.slide)?? && systemInfo.slide == "false">
  190. var verCode = $("input[name='verCode']").val()||"";
  191. if(verCode == ""){
  192. $("#msg").html("验证码不能为空!");
  193. return false;
  194. }
  195. var isvercode = $("#idvercode").val()||"";
  196. if(isvercode != "yes"){
  197. $("#msg").html("验证码错误!");
  198. return false;
  199. }
  200. </#if>
  201. </#if>
  202. }
  203. function checkIsExistUser() {
  204. var username = $("#username").val() || "";
  205. if (username == "") {
  206. $("#msg").html("用户名不能为空!");
  207. } else {
  208. $.ajax({
  209. type: "POST",
  210. url: "/findPwd/checkIsExistUser",
  211. dataType: "json",
  212. async:false,
  213. cache:false,
  214. data: {"username": username,},
  215. success: function (result) {
  216. var isExist = eval('(' + result + ')').success;
  217. if (!isExist) {
  218. $("#msg").html("用户名不存在");
  219. } else {
  220. $("#msg").html("");
  221. $("#form").submit();
  222. }
  223. }
  224. });
  225. }
  226. }
  227. </script>
  228. </body>
  229. </html>