123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <!DOCTYPE html>
- <%@ page session="true"%>
- <%@ page pageEncoding="UTF-8"%>
- <%@ page contentType="text/html; charset=UTF-8"%>
- <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
- <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
- <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
- <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
- <%@ page import="org.springframework.webflow.execution.RequestContext"%>
- <%@ page import="org.apache.commons.lang.StringUtils"%>
- <%@ page import="com.jsjty.sso.util.DesPasswordEncoder"%>
- <c:set var="basePath" value="${pageContext.request.contextPath}" />
- <%
- String userName = "";
- String passKey = "";
- //System.out.println("autoSubmit:"+request.getSession().getAttribute("autoSubmit"));
- // if(request.getSession().getAttribute("autoSubmit")==null){
- if (request.getAttribute("service") != null) {
- String service = request.getAttribute("service").toString();
- if (service.indexOf("userName") != -1
- && service.indexOf("passKey") != -1) {
- int m = service.indexOf("userName");
- int n = service.indexOf("&", m + 9);
- int j = service.indexOf("passKey");
- userName = service.substring(m + 9, n);
- passKey = service.substring(j + 8);
- passKey = DesPasswordEncoder.decrypt(passKey, "");
- userName = StringUtils.isEmpty(userName) ? "" : userName;
- passKey = StringUtils.isEmpty(passKey) ? "" : passKey;
- } else {
- userName = "";
- passKey = "";
- }
- }
- %>
- <html >
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <script type="text/javascript" src="${basePath}/js/jquery-1.7.1.min.js"></script>
- <script>
- function gotopage(){
- $('#iscredential').val("false");
- console.log("iscredential",$('#iscredential').val());
- $("#frm1").submit();
- }
- function isNotBlank(value){
- if(typeof(value)!='undefined'&&value!=null){
- value=value+"";
- for(var i=0; i<value.length; i++) {
- var c = value.charAt(i);
- if ((c!=' ')&&(c!='\n')&&(c!='\t')) return true;
- }
- }
- return false;
- }
- $(document).ready(function () {
- //openValidateExternalAccount('http://10.1.30.107//login,GKSSO,','SZmfuLcEiehu0rNSkGVYSseGkVT+QeLpjsUNmc2CsxWYtT8a1UtxrOcsWOvaR8Hb','admin','jsjt')
- //var credential='${param.credential}';
- var credential=$('#credential').val();
- <%--credential='SZmfuLcEiehu0rNSkGVYSseGkVT+QeLpjsUNmc2CsxWYtT8a1UtxrOcsWOvaR8Hb';--%>
- <%--credential="<spring:eval expression="T(com.jsjty.sso.util.DesPasswordEncoder).encrypt('{userName:\"shentz2\",userName:\"123456\"}','yjpt_gkj')" />";--%>
- <%-- http://localhost:8080/znjg/login?credential=JrDBOacSk3SETlnM%2B3PHk9TKKxl0stT5AAYziT4CRX28v2GV3Y0fng== --%>
- //credential="JrDBOacSk3SETlnM+3PHk9TKKxl0stT5AAYziT4CRX28v2GV3Y0fng==";
- //credential="<spring:eval expression="T(com.jsjty.sso.util.DesPasswordEncoder).encrypt('{username:\"shentz\",password:\"123456\"}','yjpt_gkj')" />";
- //credential="<spring:eval expression="T(com.jsjty.sso.util.DesPasswordEncoder).encrypt('{username:\"shentz\"}','yjpt_gkj')" />";
- //console.log("credential",credential);
- //console.log("iscredential",$('#iscredential').val());
- if($('#iscredential').val()!='false'&&isNotBlank(credential)){
- $.ajax({
- type : 'post',
- datatype : 'json',
- contentType : 'application/json;charset=utf-8',
- //timeout : 10000, //超时时间设置,单位毫秒
- cache : false,// 不从缓存中去数据
- async : true,
- url : "${basePath}/user/virtualDrive.html",
- data : JSON.stringify({credential:credential,verification:'true',runtime:new Date().getTime()}),
- //headers:headinfo,
- success : function(data) {
- if(data&&typeof(data)=='object'){
- //alert(typeof(data));
- //alert(JSON.stringify(data));
- //console.log(data);
- if(data.credentialDecrypt&&
- isNotBlank(data.credentialDecrypt.username)&&isNotBlank(data.credentialDecrypt.password)){
-
- if(data.credentialDecrypt){
- for(key in data.credentialDecrypt){
- $('#'+key).val(data.credentialDecrypt[key]);
- }
- }
- $('#iscredential').val("false");
- $('#credential').val("");
- $("#frm1").submit();
- }else{
- //console.log("自动登录失败...");
- }
- }
-
- },
- error : function(jqXHR, textStatus, errorThrown) {
- //alert(jqXHR.responseText);
-
- }
- });
- }
- });
- </script>
- <link rel="stylesheet" type="text/css" href="${basePath}/css/login.css" />
- <title>统一认证登录</title>
- </head>
- <body >
- <div>
- <img id="bg_images" src="${basePath}/static/image/login_bg.jpg" />
- </div>
- <img id="logo_words_portal"
- src="${basePath}/static/image/logo_words_portal.png" />
- <div id="login">
- <form:form method="post" id="frm1"
- name="frm1" commandName="${commandName}" htmlEscape="true">
- <div id="login_bg">
- <div id="usrName_div">
- <p>用户名:</p>
- <input type="text" id="username" style="background-color: #fff" value="<%=userName%>"
- accesskey="n" name="username" size="25" />
- </div>
- <div id="password_div">
- <p style="background-position: 0px -40px;">密 码:</p>
- <input type="password" id="password" value="<%=passKey%>"
- accesskey="p" name="password" size="25" />
- </div>
- </div>
- <form:errors path="*" id="msg" cssClass="errors" element="div" style="text-align:right;color:red;margin-top:-10px;padding-right:20px;" />
- <input type="hidden" name="lt" value="${loginTicket}" />
- <input type="hidden" name="execution" value="${flowExecutionKey}" />
- <input type="hidden" id="credential" name="credential" value="${param.credential}" />
- <input type="hidden" id="iscredential" name="iscredential" value="${param.iscredential}" />
- <input type="hidden" name="_eventId" value="submit" />
- <div id="button_bg">
- <button style="cursor:pointer" id="submits">登 录</button>
- </div>
- <div id="button_bg2" style="display:none">
- <button style="cursor:pointer" onclick="gotopage()">登 录2</button>
- </div>
- </form:form>
- </div>
- <footer> <img src="${basePath}/static/image/footer_img.png" />
- <p id="footer">Copyright © 2015 江苏省新通智能交通科技发展有限公司</p>
- </footer>
- <script type="text/javascript">
- $(function() {
-
- //var userName = $('#p_username').val();
- //var passKey = $('#p_password').val();
- if("<%=userName%>"!=""&&"<%=passKey%>" != "") {
- // $('#username').val(userName);
- // $('#password').val(passKey);
- // $('#p_username').val("");
- // $('#p_password').val("");
- //alert("自动提交表单");
- $("#frm1").submit();
- }
- //User.manage.viewform.init();
- });
- </script>
- </body>
- </html>
|