Sfoglia il codice sorgente

【修改】统一认证登录优化;

长阳分支中职
dyy 3 settimane fa
parent
commit
4d98f53e81
2 ha cambiato i file con 41 aggiunte e 29 eliminazioni
  1. +40
    -28
      Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs
  2. +1
    -1
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs

+ 40
- 28
Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs Vedi File

@@ -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("跳转失败");
}




+ 1
- 1
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Util/Learun.Util/Security/DESEncrypt.cs Vedi File

@@ -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();


Caricamento…
Annulla
Salva