diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs index b5da5e1f5..25b20b8e8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/HomeController.cs @@ -101,11 +101,11 @@ namespace Learun.Application.Web.Controllers var url = perm_application.FInterfaceUrl; if (url.Contains("?")) { - url += "&appkey=" + Md5Helper.Encrypt(perm_application.FSecret, 32) + "&name=" + DESEncrypt.Encrypt(userinfo.realName, perm_application.FSecret, false) + "&type=" + type + "&no=" + DESEncrypt.Encrypt(userinfo.enCode, perm_application.FSecret, false) + "&a=" + DESEncrypt.Encrypt(userinfo.enCode); + url += "&appkey=" + Md5Helper.Encrypt(perm_application.FSecret, 32) + "&name=" + DESEncrypt.Encrypt(userinfo.realName, perm_application.FSecret, false) + "&no=" + DESEncrypt.Encrypt(userinfo.enCode, perm_application.FSecret, false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(userinfo.loginMark) + "&t=" + DESEncrypt.Encrypt(userinfo.token); } else { - url += "?appkey=" + Md5Helper.Encrypt(perm_application.FSecret, 32) + "&name=" + DESEncrypt.Encrypt(userinfo.realName, perm_application.FSecret, false) + "&type=" + type + "&no=" + DESEncrypt.Encrypt(userinfo.enCode, perm_application.FSecret, false) + "&a=" + DESEncrypt.Encrypt(userinfo.enCode); + url += "?appkey=" + Md5Helper.Encrypt(perm_application.FSecret, 32) + "&name=" + DESEncrypt.Encrypt(userinfo.realName, perm_application.FSecret, false) + "&no=" + DESEncrypt.Encrypt(userinfo.enCode, perm_application.FSecret, false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(userinfo.loginMark) + "&t=" + DESEncrypt.Encrypt(userinfo.token); } return Redirect(url); } 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 0feb9ff09..4fe13d85b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/LoginController.cs @@ -23,6 +23,7 @@ using Quanjiang.DigitalScholl.SendSms; using System.Collections.Generic; using Learun.Cache.Redis; using Learun.Application.TwoDevelopment.PersonnelManagement; +using Learun.Application.TwoDevelopment.Permission; namespace Learun.Application.Web.Controllers { @@ -46,6 +47,13 @@ namespace Learun.Application.Web.Controllers WeChatDevelopIBLL weChatDevelopIbll = new WeChatDevelopBLL(); private Sys_DefaultPwdConfigIBLL sys_DefaultPwdConfigIBLL = new Sys_DefaultPwdConfigBLL(); private VisitorInfoIBLL visitorInfoIBLL = new VisitorInfoBLL(); + private Perm_FunctionIBLL perm_FunctionIBLL = new Perm_FunctionBLL(); + private Perm_FunctionVisitIBLL functionVisitIbll = new Perm_FunctionVisitBLL(); + + /// + /// 标记登录的浏览器 + /// + private string LoginUserMarkKey = "Learun_ADMS_V7_Mark"; #endregion private readonly ISms _aliyunSms = new AliyunSms(); CacheByRedis _redis = new CacheByRedis(); @@ -204,7 +212,18 @@ namespace Learun.Application.Web.Controllers } //获取高职版跳转地址 ViewBag.DigitalschoolMisLoginurl = ConfigurationManager.AppSettings["DigitalschoolMisLoginurl"]; - ViewBag.Returnurl = "http://" + Request.Url.Host + ":" + Request.Url.Port; + //ViewBag.Returnurl = "http://" + Request.Url.Host + ":" + Request.Url.Port; + + + + if (!Request.QueryString["Returnurl"].IsEmpty()) + { + ViewBag.Returnurl = Request.QueryString["Returnurl"]; + }; + if (!Request.QueryString["appid"].IsEmpty()) + { + ViewBag.appid = Request.QueryString["appid"].ToString(); + }; //获取登录页二维码配置信息 ViewBag.HasQRCode = false; @@ -541,6 +560,7 @@ namespace Learun.Application.Web.Controllers OperatorHelper.Instance.EmptyCurrent(); return Success("退出系统"); } + /// /// 登录验证 /// @@ -553,9 +573,9 @@ namespace Learun.Application.Web.Controllers [HttpPost] [AjaxOnly] //[HandlerValidateAntiForgeryToken] - public ActionResult CheckLogin(string username, string password, string verifycode, string up, string defaultPwdTip) + public ActionResult CheckLogin(string username, string password, string verifycode, string up, string defaultPwdTip, string appid, string Returnurl) { - + string token = ""; int error = OperatorHelper.Instance.GetCurrentErrorNum(); if (error >= 3) { @@ -636,7 +656,8 @@ namespace Learun.Application.Web.Controllers { //记录ip userBll.UpdateIp(GetIP(), userEntity.F_UserId); - OperatorHelper.Instance.AddLoginUser(userEntity.F_Account, "Learun_ADMS_6.1_PC", null);//写入缓存信息 + token = OperatorHelper.Instance.AddLoginUser(userEntity.F_Account, "Learun_ADMS_6.1_PC", null);//写入缓存信息 + string loginMark = WebHelper.GetCookie(LoginUserMarkKey).ToString(); //写入日志 logEntity.F_ExecuteResult = 1; logEntity.F_ExecuteResultJson = "登录成功"; @@ -644,11 +665,47 @@ namespace Learun.Application.Web.Controllers OperatorHelper.Instance.ClearCurrentErrorNum(); //修改用户的允许登录结束时间; userBll.UpdateAllowEndTime(userEntity.F_UserId, 0); + + if (!Returnurl.IsEmpty() && !appid.IsEmpty()) + { + var perm_application = perm_FunctionIBLL.GetPerm_FunctionEntity(appid); + if (perm_application != null) + { + var userinfo = LoginUserInfo.Get(); + //写入当前请求所登录的用户 + var type = 0;//1学生 0教师 + if (userEntity.F_Description == "学生") + { + type = 1; + } + if (Returnurl.Contains("?")) + { + Returnurl += "&appkey=" + Md5Helper.Encrypt(perm_application.FSecret, 32) + "&name=" + DESEncrypt.Encrypt(userEntity.F_RealName, perm_application.FSecret, false) + "&no=" + DESEncrypt.Encrypt(userEntity.F_EnCode, perm_application.FSecret, false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(userinfo.loginMark) + "&t=" + DESEncrypt.Encrypt(token); + } + else + { + Returnurl += "?appkey=" + Md5Helper.Encrypt(perm_application.FSecret, 32) + "&name=" + DESEncrypt.Encrypt(userEntity.F_RealName, perm_application.FSecret, false) + "&no=" + DESEncrypt.Encrypt(userEntity.F_EnCode, perm_application.FSecret, false) + "&type=" + type + "&m=" + DESEncrypt.Encrypt(userinfo.loginMark) + "&t=" + DESEncrypt.Encrypt(token); + } + } + 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 }); + } + + //是否强密码验证 if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["verifypwd"]) && ConfigurationManager.AppSettings["verifypwd"] == "true" && up == "false") { return Success(new { pwd = true, pwdtip = defaultPwdTip == "true" ? true : false }); } + //返回成功的数据(pwdtip:初始密码提示弹框;pwd:弱密码修改弹框;) return Success("登录成功", new { pwdtip = defaultPwdTip == "true" ? true : false }); } @@ -1167,7 +1224,7 @@ namespace Learun.Application.Web.Controllers { return Fail("账户被系统锁定,请联系管理员!"); } - + userBll.setPassword(userEntity.F_UserId, newPassword); //删除验证码 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs index 1afd9f2ee..dd788fb7b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Controllers/SSOSystemController.cs @@ -933,10 +933,11 @@ namespace Learun.Application.Web.Controllers { if (!string.IsNullOrEmpty(perfun.UPUserName) && !string.IsNullOrEmpty(perfun.UPPass)) { + var user = LoginUserInfo.Get(); functionVisitEntity.PIsLoginSuccess = true; functionVisitEntity.PContent = "成功转到统一认证网站:" + perfun.FUrl; functionVisitIbll.SaveEntity(null, functionVisitEntity); - return Redirect(perfun.FInterfaceUrl + "?u=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPUserName, secretkey), publickey) + "&p=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPPass, secretkey), publickey) + "&t=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), secretkey), publickey) + "&ip=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(GetIP(), secretkey), publickey)); + return Redirect(perfun.FInterfaceUrl + "?u=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPUserName, secretkey), publickey) + "&p=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(perfun.UPPass, secretkey), publickey) + "&t=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(DateTime.Now.ToString("yyyyMMddHHmmss"), secretkey), publickey) + "&ip=" + DESEncrypt.Encrypt(DESEncrypt.Encrypt(GetIP(), secretkey), publickey)+"&m=" + DESEncrypt.Encrypt(user.loginMark) + "&t=" + DESEncrypt.Encrypt(user.token)); } else { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/Default.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/Default.cshtml index 22e007b5a..068dddb5a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/Default.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Views/Login/Default.cshtml @@ -26,21 +26,24 @@ width: 880px; margin: auto; } - .tips{ - position: absolute; - left: 50%; - bottom: 35px; - color: #fff; - font-size: 13px; - margin-left: -91px; - } - .tips > *{ - display: inline-block; - vertical-align: middle; - } - .tips img{ - margin-right: 8px - } + + .tips { + position: absolute; + left: 50%; + bottom: 35px; + color: #fff; + font-size: 13px; + margin-left: -91px; + } + + .tips > * { + display: inline-block; + vertical-align: middle; + } + + .tips img { + margin-right: 8px + } @@ -49,7 +52,7 @@ - +
@@ -79,14 +82,16 @@
@**@ + + +
*@
密码不正确