diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs index 0ef30f336..be6d6c793 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs @@ -666,39 +666,51 @@ namespace Learun.Application.Web.Controllers //修改用户的允许登录结束时间; userBll.UpdateAllowEndTime(userEntity.F_UserId, 0); - if (!Returnurl.IsEmpty() && !appid.IsEmpty()) + try { - var perm_application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); - if (perm_application != null) + if (!Returnurl.IsEmpty() && !appid.IsEmpty()) { - //var userinfo = LoginUserInfo.Get(); - //写入当前请求所登录的用户 - var type = 0;//1学生 0教师 - if (userEntity.F_Description == "学生") + var perm_application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); + if (perm_application != null) { - type = 1; - } - var url = HttpUtility.UrlDecode(Returnurl); - if (url.Contains("?")) - { - url += "&appkey=" + Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) + "&name=" + DESEncrypt.Encrypt(userEntity.F_RealName, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&no=" + DESEncrypt.Encrypt(userEntity.F_IdentityCardNo, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&acc=" + DESEncrypt.Encrypt(userEntity.F_EnCode, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token); - } - else - { - url += "?appkey=" + Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) + "&name=" + DESEncrypt.Encrypt(userEntity.F_RealName, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&no=" + DESEncrypt.Encrypt(userEntity.F_IdentityCardNo, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&acc=" + DESEncrypt.Encrypt(userEntity.F_EnCode, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token); + //var userinfo = LoginUserInfo.Get(); + //写入当前请求所登录的用户 + var type = 0;//1学生 0教师 + if (userEntity.F_Description == "学生") + { + type = 1; + } + var url = HttpUtility.UrlDecode(Returnurl); + if (url.Contains("?")) + { + url += "&appkey=" + Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) + "&name=" + DESEncrypt.Encrypt(userEntity.F_RealName, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&no=" + DESEncrypt.Encrypt(userEntity.F_IdentityCardNo, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&acc=" + DESEncrypt.Encrypt(userEntity.F_EnCode, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token); + } + else + { + url += "?appkey=" + Md5Helper.Encrypt(Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), 32) + "&name=" + DESEncrypt.Encrypt(userEntity.F_RealName, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&no=" + DESEncrypt.Encrypt(userEntity.F_IdentityCardNo, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&acc=" + DESEncrypt.Encrypt(userEntity.F_EnCode, Util.DESEncrypt.Decrypt(perm_application.FSecret, ConfigurationManager.AppSettings["SSOPublicSecret"]), false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(loginMark) + "&t=" + DESEncrypt.Encrypt(token); + } + Returnurl = url; } - Returnurl = url; + Perm_FunctionVisitEntity functionVisitEntity = new Perm_FunctionVisitEntity(); + functionVisitEntity.Create(); + functionVisitEntity.Fid = perm_application.FId; + functionVisitEntity.PDate = DateTime.Now; + functionVisitEntity.PUId = userEntity.F_UserId; + functionVisitEntity.PUName = userEntity.F_RealName; + functionVisitEntity.PIsLoginSuccess = true; + functionVisitEntity.PContent = "成功跳转到:" + Returnurl; + functionVisitIbll.SaveEntity(null, functionVisitEntity); + return Success("登录成功", new { FInterfaceUrl = Returnurl }); } - Perm_FunctionVisitEntity functionVisitEntity = new Perm_FunctionVisitEntity(); - functionVisitEntity.Create(); - functionVisitEntity.Fid = perm_application.FId; - functionVisitEntity.PDate = DateTime.Now; - functionVisitEntity.PUId = userEntity.F_UserId; - functionVisitEntity.PUName = userEntity.F_RealName; - functionVisitEntity.PIsLoginSuccess = true; - functionVisitEntity.PContent = "成功跳转到:" + Returnurl; - functionVisitIbll.SaveEntity(null, functionVisitEntity); - return Success("登录成功", new { FInterfaceUrl = Returnurl }); + + } + catch (Exception ex) + { + logEntity.F_ExecuteResult = 0; + logEntity.F_ExecuteResultJson = "跳转失败:" + ex; + logEntity.F_SourceContentJson = "Returnurl:" + Returnurl + " appid:" + appid; + logEntity.WriteLog(); + return Fail("跳转失败"); } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs index 0c5b61091..15c18a95e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs @@ -42,7 +42,7 @@ namespace Learun.Util } DESCryptoServiceProvider des = new DESCryptoServiceProvider(); byte[] inputByteArray; - inputByteArray = Encoding.Default.GetBytes(Text); + inputByteArray = Encoding.Default.GetBytes(Text ?? ""); des.Key = ASCIIEncoding.ASCII.GetBytes(key); des.IV = ASCIIEncoding.ASCII.GetBytes(iv); System.IO.MemoryStream ms = new System.IO.MemoryStream();