@@ -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); | |||
} | |||
@@ -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(); | |||
/// <summary> | |||
/// 标记登录的浏览器 | |||
/// </summary> | |||
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("退出系统"); | |||
} | |||
/// <summary> | |||
/// 登录验证 | |||
/// </summary> | |||
@@ -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); | |||
//删除验证码 | |||
@@ -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 | |||
{ | |||
@@ -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 | |||
} | |||
</style> | |||
</head> | |||
@@ -49,7 +52,7 @@ | |||
<link href="~/Content/css/process.css" rel="stylesheet" /> | |||
<!-- <img src="~/Content/images/Logins/loginBg.jpg" /> --> | |||
<input id="errornum" type="hidden" value="@ViewBag.errornum" /> | |||
<input id="DefaultPwd" type="hidden" value="@ViewBag.DefaultPwd" data-IsSetDefaultPwd="@ViewBag.IsSetDefaultPwd"/> | |||
<input id="DefaultPwd" type="hidden" value="@ViewBag.DefaultPwd" data-IsSetDefaultPwd="@ViewBag.IsSetDefaultPwd" /> | |||
<div class="lr-login-body"> | |||
@@ -79,14 +82,16 @@ | |||
<!--登录框 正常登录--> | |||
<div class="lr-login-main lr-login-normal"> | |||
@*<div class="loginImg" style="display:none;"> | |||
<img class="loginImg1" src="~/Content/images/logins/login3.png" alt=""> | |||
<img class="loginImg2" src="~/Content/images/logins/login5.png" alt=""> | |||
</div>*@ | |||
<img class="loginImg1" src="~/Content/images/logins/login3.png" alt=""> | |||
<img class="loginImg2" src="~/Content/images/logins/login5.png" alt=""> | |||
</div>*@ | |||
<!--密码登录--> | |||
<div class="lr-login-bypsw noreg"> | |||
<div class="error_info">* <span>密码不正确</span></div> | |||
<div class="lr-login-input"> | |||
<img class="inp_icon" src="~/Content/images/Login/default_account0.png" alt=""> <input id="lr_username" type="text" placeholder="身份证号"> | |||
<input id="Returnurl" type="hidden" value="@ViewBag.Returnurl" /> | |||
<input id="appid" type="hidden" value="@ViewBag.appid"/> | |||
</div> | |||
<div class="lr-login-input"> | |||
<img class="inp_icon" src="~/Content/images/Login/default_psw0.png" alt=""><input id="lr_password" type="password" placeholder="密码"> | |||
@@ -143,6 +148,7 @@ | |||
$.lrToken = $('@Html.AntiForgeryToken()').val(); | |||
var DigitalschoolMisLoginurl = "@ViewBag.DigitalschoolMisLoginurl"; | |||
var Returnurl = "@ViewBag.Returnurl"; | |||
var appid = "@ViewBag.appid"; | |||
var Ip = "@ViewBag.Ip"; | |||
var ACIp = "@ViewBag.ACIp"; | |||
var ACIp2 = "@ViewBag.ACIp2"; | |||
@@ -170,7 +170,8 @@ | |||
$.ajax({ | |||
url: $.rootUrl + "/Login/CheckLogin", | |||
headers: { __RequestVerificationToken: $.lrToken }, | |||
data: { username: username, password: password, verifycode: verifycode, up: up, defaultPwdTip: defaultPwdTip }, | |||
//data: { username: username, password: password, verifycode: verifycode, up: up, defaultPwdTip: defaultPwdTip }, | |||
data: { username: username, password: password, verifycode: verifycode, up: up, defaultPwdTip: defaultPwdTip,Returnurl: Returnurl, appid: appid }, | |||
type: "post", | |||
dataType: "json", | |||
success: function (res) { | |||
@@ -258,15 +258,15 @@ namespace Learun.Application.WebApi.Modules | |||
//写入当前请求所登录的用户 | |||
var code = Util.CommonHelper.RndNum(9); | |||
cache.Write(code, userinfo.account, TimeSpan.FromMinutes(10)); | |||
var url = perm_application.FInterfaceUrl; | |||
if (url.Contains("?")) | |||
{ | |||
url += "&appkey=" + Md5Helper.Encrypt(perm_application.FSecret, 32) + "&name=" + DESEncrypt.Encrypt(userinfo.realName, perm_application.FSecret) + "&type=" + type + "&a=" + DESEncrypt.Encrypt(userinfo.enCode, perm_application.FSecret); | |||
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) + "&type=" + type + "&a=" + DESEncrypt.Encrypt(userinfo.enCode, perm_application.FSecret); | |||
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 Success(new { FInterfaceUrl = url }); | |||
} | |||
@@ -316,6 +316,7 @@ namespace Learun.Application.WebApi.Modules | |||
functionVisitEntity.PIsLoginSuccess = true; | |||
functionVisitEntity.PContent = "成功转到统一认证网站:" + perfun.FUrl; | |||
functionVisitIbll.SaveEntity(null, functionVisitEntity); | |||
var user = LoginUserInfo.Get(); | |||
return Success(new | |||
{ | |||
FInterfaceUrl = perfun.FInterfaceUrl + "?u=" + | |||
@@ -327,6 +328,7 @@ namespace Learun.Application.WebApi.Modules | |||
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 | |||