src/main/java/com/lf/server/controller/sys/SignController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/lf/server/service/data/LoginService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/data/LoginMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/mapper/data/TokenMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/resources/templates/login.html | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/lf/server/controller/sys/SignController.java
@@ -88,7 +88,7 @@ return fail("用户名不存在!", null); } LoginEntity le = loginService.getNewLogin(user.getId(), req); LoginEntity le = loginService.getNewLogin(ue.getId(), req); if (!user.getPwd().equals(ue.getPwd())) { le.setStatus(0); le.setDescr("密码错误"); @@ -96,10 +96,17 @@ return fail("密码不正确!", null); } le.setStatus(1); loginService.insertLogin(le); Integer rows = loginService.insertLogin(le); if (rows == 0) { return fail("创建登录日志失败!", null); } TokenEntity te = tokenService.getNewToken(ue.getId(), req); tokenService.insertToken(te); rows = tokenService.insertToken(te); if (rows == 0) { return fail("创建令牌信息失败!", null); } return success(te); } catch (Exception ex) { src/main/java/com/lf/server/service/data/LoginService.java
@@ -68,6 +68,7 @@ LoginEntity le = new LoginEntity(); le.setAppid(1); le.setIp(WebHelper.getIpAddress(req)); le.setType(1); le.setUserid(userid); le.setOptime(WebHelper.getCurrentTimestamp()); src/main/resources/mapper/data/LoginMapper.xml
@@ -24,7 +24,6 @@ limit #{limit} offset #{offset} </select> <select id="selectLoginAll" resultType="com.lf.server.entity.data.LoginEntity"> select * from lf.sys_login order by id; </select> @@ -34,6 +33,10 @@ </select> <insert id="insertLogin" parameterType="com.lf.server.entity.data.LoginEntity"> <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> select currval('lf.sys_login_id_seq'::regclass) as id </selectKey> insert into lf.sys_login (appid,ip,type,status,descr,userid,optime) values src/main/resources/mapper/data/TokenMapper.xml
@@ -40,6 +40,10 @@ </select> <insert id="insertToken" parameterType="com.lf.server.entity.data.TokenEntity"> <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id"> select currval('lf.sys_token_id_seq'::regclass) as id </selectKey> insert into lf.sys_token (token,duration,expire,type,ip,create_user,create_time) values src/main/resources/templates/login.html
@@ -7,42 +7,11 @@ <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="expires" content="0" /> <link href="../favicon.ico" rel="icon" type="image/x-icon" /> <link href="../css/reset.css" rel="stylesheet" /> <link href="../css/JCXM_style.css" rel="stylesheet" /> <link href="../css/style.css" rel="stylesheet" /> <script src="../js/jquery.min.js"></script> <script src="../js/zxcvbn.js"></script> <script src="../js/jquery.cookie.min.js"></script> <script src="../js/zxcvbn.js"></script> <script src="../js/rsa.min.js"></script> <style> .code { font-family: Arial; font-style: italic; color: blue; font-size: 30px; border: 0; padding: 2px 3px; letter-spacing: 3px; font-weight: bolder; float: left; cursor: pointer; width: 88px; height: 35px; line-height: 34px; text-align: center; vertical-align: middle; border-top-right-radius: 5px; border-bottom-right-radius: 5px; background-color: white; } a { text-decoration: underline; } a:hover { text-decoration: underline; } </style> </head> <body style="background-color: #0059cf; overflow-y: hidden !important;"> <form method="post" id="fm1" class="fm-v clearfix" action="/sign/login"> @@ -222,11 +191,13 @@ $("body").css("overflow", "hidden"); } div_obj.style.width = fullWidth + "px"; if (winHeight > bgHeight) { div_obj.style.height = winHeight + "px"; var marginTop = parseFloat($(".logintable").css("margin-top").replace("px")) + (winHeight - bgHeight); $(".logintable").css("margin-top", marginTop + "px"); } // 高度自适应 var fullHeight = document.body.offsetHeight; var myHeight = div_obj.offsetHeight; @@ -293,15 +264,15 @@ var data = { "uid": username, "pwd": password, "bak": service "bak": "http://www.baidu.com" }; $.ajax({ url: "sign/login", url: "login", type: "POST", data: JSON.stringify(data), dataType: "json", // html、json、jsonp、script、text contentType: "json", // "application/json", "application/x-www-form-urlencoded", contentType: "application/json", // "application/json", "application/x-www-form-urlencoded", success: function (rs) { alert(rs); },