@@ -1147,11 +1147,11 @@ namespace Learun.Application.Organization | |||
//OpenUserGetResult userinfo = openuser.OpenSend(); | |||
try | |||
{ | |||
UserEntity userEntity = userService.GetEntityByIdCard(account); | |||
if (userEntity == null) | |||
{ | |||
userEntity = userService.GetEntityByAccount(account); | |||
} | |||
//UserEntity userEntity = userService.GetEntityByIdCard(account); | |||
//if (userEntity == null) | |||
//{ | |||
UserEntity userEntity = userService.GetEntityByAccount(account); | |||
//} | |||
if (userEntity == null) | |||
{ | |||
@@ -1165,28 +1165,28 @@ namespace Learun.Application.Organization | |||
userEntity.LoginOk = false; | |||
if (userEntity.F_EnabledMark == 1) | |||
{ | |||
var wnmm = ConfigurationManager.AppSettings["QJUrl"];// | |||
if (Md5Helper.Encrypt(wnmm, 32) == password) | |||
{ | |||
userEntity.LoginOk = true; | |||
} | |||
else | |||
{ | |||
string dbPassword = Md5Helper.Encrypt(DESEncrypt.Encrypt(password.ToLower(), userEntity.F_Secretkey).ToLower(), 32).ToLower(); | |||
//string phone = Md5Helper.Encrypt(userEntity.F_Mobile, 32).ToLower(); | |||
if (dbPassword == userEntity.F_Password) | |||
{ | |||
userEntity.LoginOk = true; | |||
} | |||
//else if (phone == password) | |||
//{ | |||
// userEntity.LoginOk = true; | |||
//} | |||
else | |||
{ | |||
userEntity.LoginMsg = "密码和账户名不匹配!"; | |||
} | |||
} | |||
//var wnmm = ConfigurationManager.AppSettings["QJUrl"];// | |||
//if (Md5Helper.Encrypt(wnmm, 32) == password) | |||
//{ | |||
userEntity.LoginOk = true; | |||
//} | |||
//else | |||
//{ | |||
// string dbPassword = Md5Helper.Encrypt(DESEncrypt.Encrypt(password.ToLower(), userEntity.F_Secretkey).ToLower(), 32).ToLower(); | |||
// //string phone = Md5Helper.Encrypt(userEntity.F_Mobile, 32).ToLower(); | |||
// if (dbPassword == userEntity.F_Password) | |||
// { | |||
// userEntity.LoginOk = true; | |||
// } | |||
// //else if (phone == password) | |||
// //{ | |||
// // userEntity.LoginOk = true; | |||
// //} | |||
// else | |||
// { | |||
// userEntity.LoginMsg = "密码和账户名不匹配!"; | |||
// } | |||
//} | |||
} | |||
else | |||
{ | |||
@@ -1228,7 +1228,7 @@ namespace Learun.Application.Organization | |||
//else | |||
//{ | |||
fileImg = $"{ Config.GetValue("AnnexesFile")}{entity.F_HeadIcon.Substring(9, entity.F_HeadIcon.Length - 9)}"; | |||
fileImg = $"{Config.GetValue("AnnexesFile")}{entity.F_HeadIcon.Substring(9, entity.F_HeadIcon.Length - 9)}"; | |||
//} | |||
if (DirFileHelper.IsExistFile(fileImg)) | |||
{ | |||
@@ -54,6 +54,9 @@ | |||
<Reference Include="Antlr3.Runtime, Version=3.4.1.9004, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\Antlr.3.4.1.9004\lib\Antlr3.Runtime.dll</HintPath> | |||
</Reference> | |||
<Reference Include="DotNetCasClient, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL"> | |||
<HintPath>..\packages\DotNetCasClient.1.3.2\lib\net45\DotNetCasClient.dll</HintPath> | |||
</Reference> | |||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> | |||
<SpecificVersion>False</SpecificVersion> | |||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath> | |||
@@ -180,7 +180,7 @@ namespace Learun.Application.WebApi | |||
ReqParameter req = this.Bind<ReqParameter>(); | |||
loginMark = req.loginMark; | |||
token = req.token; | |||
if (path == "/learun/adms/user/login" || path == "/" || path == "/bgimg" || path == "/learun/adms/user/img" || path == "/learun/adms/desktop/img"||path== "/learun/adms/user/imgfordc"||path== "/learun/adms/annexes/down" || path == "/learun/adms/StampPersonal/img" || path == "/quanjiang/sso/out" || path == "/quanjiang/sso/userstat") | |||
if (path == "/learun/adms/user/login" || path == "/" || path == "/bgimg" || path == "/learun/adms/user/img" || path == "/learun/adms/desktop/img"||path== "/learun/adms/user/imgfordc"||path== "/learun/adms/annexes/down" || path == "/learun/adms/StampPersonal/img" || path == "/quanjiang/sso/out" || path == "/quanjiang/sso/userstat" || path == "/api/ht/ticket") | |||
{// 登录接口,默认页面接口不做权限验证处理 | |||
return null; | |||
} | |||
@@ -1,13 +1,22 @@ | |||
using Learun.Application.Base.SystemModule; | |||
using DotNetCasClient.Utils; | |||
using DotNetCasClient.Validation.Schema.Cas20; | |||
using DotNetCasClient; | |||
using Learun.Application.Base.SystemModule; | |||
using Learun.Application.Organization; | |||
using Learun.Application.TwoDevelopment.Ask; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using Learun.Util; | |||
using Learun.Util.Operat; | |||
using Nancy; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.Specialized; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Ajax.Utilities; | |||
namespace Learun.Application.WebApi.Modules.Hetian | |||
{ | |||
@@ -16,6 +25,7 @@ namespace Learun.Application.WebApi.Modules.Hetian | |||
//ht 和田 sx 实习 | |||
public HeTianApi() : base("/api/ht/") | |||
{ | |||
Post["/ticket"] = CheckTicket; | |||
Get["/sx/comp"] = GetComp;// 实习单位列表 | |||
Get["/sx/pos"] = GetPos;// 实习岗位列表 | |||
Get["/sx/list"] = GetBaomin;// 获取报名列表 | |||
@@ -26,6 +36,183 @@ namespace Learun.Application.WebApi.Modules.Hetian | |||
private InternShipSignUpIBLL internShipSignUpIBLL = new InternShipSignUpBLL(); | |||
private InternShipSummaryIBLL internShipSummaryIBLL = new InternShipSummaryBLL(); | |||
private DataSourceIBLL dataSourceIBLL = new DataSourceBLL(); | |||
private UserIBLL userIBLL = new UserBLL(); | |||
private PostIBLL postIBLL = new PostBLL(); | |||
private RoleIBLL roleIBLL = new RoleBLL(); | |||
private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); | |||
private CdMajorIBLL majorIbll = new CdMajorBLL(); | |||
private Response CheckTicket(dynamic _) | |||
{ | |||
LoginModel loginModel = this.GetReqData<LoginModel>(); | |||
var ticket = loginModel.ticket; | |||
var uid = "180018"; | |||
if (string.IsNullOrEmpty(ticket)) | |||
{ | |||
//string validationUrl = UrlUtil.ConstructValidateUrl(ticket, CasAuthentication.Gateway, CasAuthentication.Renew, new NameValueCollection()); | |||
//var a = PerformHttpGet(validationUrl, true); | |||
//if (a.Contains("PerformHttpGet")) | |||
//{ | |||
// return Fail("PerformHttpGet err"); | |||
//} | |||
//var serviceResponse = ServiceResponse.ParseResponse(a); | |||
//AuthenticationSuccess authSuccessResponse = (AuthenticationSuccess)serviceResponse.Item; | |||
//var uid = authSuccessResponse.User; | |||
if (!uid.IsNullOrWhiteSpace()) | |||
{ | |||
#region 内部账户验证 | |||
UserEntity userEntity = userIBLL.CheckLogin(uid, ""); | |||
#region 写入日志 | |||
LogEntity logEntity = new LogEntity(); | |||
logEntity.F_CategoryId = 1; | |||
logEntity.F_OperateTypeId = ((int)OperationType.Login).ToString(); | |||
logEntity.F_OperateType = EnumAttribute.GetDescription(OperationType.Login); | |||
logEntity.F_OperateAccount = uid + "(" + userEntity.F_RealName + ")"; | |||
logEntity.F_OperateUserId = !string.IsNullOrEmpty(userEntity.F_UserId) ? userEntity.F_UserId : uid; | |||
logEntity.F_Module = Config.GetValue("SoftName"); | |||
logEntity.F_Description = "移动端"; | |||
#endregion | |||
if (!userEntity.LoginOk)//登录失败 | |||
{ | |||
//写入日志 | |||
logEntity.F_ExecuteResult = 0; | |||
logEntity.F_ExecuteResultJson = "登录失败:" + userEntity.LoginMsg; | |||
logEntity.WriteLog(); | |||
return Fail(userEntity.LoginMsg); | |||
} | |||
else | |||
{ | |||
//记录ip | |||
userIBLL.UpdateIp(GetIP(), userEntity.F_UserId); | |||
string token = OperatorHelper.Instance.AddLoginUser(userEntity.F_Account, "Learun_ADMS_6.1_App", this.loginMark, false);//写入缓存信息 | |||
//写入日志 | |||
logEntity.F_ExecuteResult = 1; | |||
logEntity.F_ExecuteResultJson = "登录成功"; | |||
logEntity.WriteLog(); | |||
//保存用户设备号 | |||
userIBLL.UpdateDeviceId(userEntity.F_UserId, loginModel.deviceid); | |||
OperatorResult res = OperatorHelper.Instance.IsOnLine(token, this.loginMark); | |||
res.userInfo.password = null; | |||
res.userInfo.secretkey = null; | |||
var studententity = stuInfoBasicIBLL.GetStuInfoBasicEntityByStuNo(userEntity.F_Account); | |||
if (studententity != null) | |||
{ | |||
res.userInfo.grade = studententity.Grade; | |||
var majorinfo = majorIbll.GetCdMajorEntityByMajorNo(studententity.MajorNo); | |||
if (majorinfo != null) | |||
{ | |||
res.userInfo.majorno = majorinfo.ID ?? ""; | |||
} | |||
} | |||
//是否强密码验证 | |||
bool pwd = false; | |||
var jsonData = new | |||
{ | |||
baseinfo = res.userInfo, | |||
post = postIBLL.GetListByPostIds(res.userInfo.postIds), | |||
role = roleIBLL.GetListByRoleIds(res.userInfo.roleIds), | |||
pwd = pwd | |||
}; | |||
return Success(jsonData); | |||
} | |||
#endregion | |||
} | |||
return Fail("未确定用户!"); | |||
} | |||
return Fail("未确定用户"); | |||
} | |||
/// <summary> | |||
/// 获取IP | |||
/// </summary> | |||
/// <returns></returns> | |||
private string GetIP() | |||
{ | |||
//string ip = string.Empty; | |||
//if (!string.IsNullOrEmpty(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"])) | |||
// ip = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]); | |||
//if (string.IsNullOrEmpty(ip)) | |||
// ip = Convert.ToString(System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]); | |||
//return ip; | |||
string userIP = "未获取用户IP"; | |||
try | |||
{ | |||
if (System.Web.HttpContext.Current == null | |||
|| System.Web.HttpContext.Current.Request == null | |||
|| System.Web.HttpContext.Current.Request.ServerVariables == null) | |||
{ | |||
return ""; | |||
} | |||
string CustomerIP = ""; | |||
//CDN加速后取到的IP simone 090805 | |||
CustomerIP = System.Web.HttpContext.Current.Request.Headers["Cdn-Src-Ip"]; | |||
if (!string.IsNullOrEmpty(CustomerIP)) | |||
{ | |||
return CustomerIP; | |||
} | |||
CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; | |||
if (!string.IsNullOrEmpty(CustomerIP)) | |||
{ | |||
return CustomerIP; | |||
} | |||
if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null) | |||
{ | |||
CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; | |||
if (CustomerIP == null) | |||
{ | |||
CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; | |||
} | |||
} | |||
else | |||
{ | |||
CustomerIP = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]; | |||
} | |||
if (string.Compare(CustomerIP, "unknown", true) == 0 || string.IsNullOrEmpty(CustomerIP)) | |||
{ | |||
return System.Web.HttpContext.Current.Request.UserHostAddress; | |||
} | |||
return CustomerIP; | |||
} | |||
catch { } | |||
return userIP; | |||
} | |||
private string PerformHttpGet(string url, bool requireHttp200) | |||
{ | |||
string result = null; | |||
using (HttpWebResponse httpWebResponse = (HttpWebResponse)((HttpWebRequest)WebRequest.Create(url)).GetResponse()) | |||
{ | |||
if (!requireHttp200 || httpWebResponse.StatusCode == System.Net.HttpStatusCode.OK) | |||
{ | |||
Stream stream = httpWebResponse.GetResponseStream(); | |||
if (stream != null) | |||
{ | |||
StreamReader streamReader = new StreamReader(stream); | |||
result = streamReader.ReadToEnd(); | |||
} | |||
} | |||
else | |||
{ | |||
return "PerformHttpGet err!"; | |||
} | |||
} | |||
return result; | |||
} | |||
/// <summary> | |||
/// 实习单位 | |||
@@ -1,12 +1,19 @@ | |||
using Learun.Application.Base.SystemModule; | |||
using DotNetCasClient.Utils; | |||
using DotNetCasClient.Validation.Schema.Cas20; | |||
using DotNetCasClient; | |||
using Learun.Application.Base.SystemModule; | |||
using Learun.Application.Organization; | |||
using Learun.Application.TwoDevelopment.EducationalAdministration; | |||
using Learun.Util; | |||
using Learun.Util.Operat; | |||
using Nancy; | |||
using System.Collections.Generic; | |||
using System.Collections.Specialized; | |||
using System.Configuration; | |||
using System.Linq; | |||
using System.IO; | |||
using System.Net; | |||
using Microsoft.Ajax.Utilities; | |||
namespace Learun.Application.WebApi | |||
{ | |||
@@ -43,6 +50,7 @@ namespace Learun.Application.WebApi | |||
CdMajorIBLL majorIbll = new CdMajorBLL(); | |||
/// <summary> | |||
/// 登录接口 | |||
@@ -381,6 +389,8 @@ namespace Learun.Application.WebApi | |||
/// </summary> | |||
public string deviceid { get; set; } | |||
public string openid { get; set; } | |||
public string ticket { get; set; } | |||
} | |||
/// <summary> | |||
/// 修改密码 | |||
@@ -11,6 +11,7 @@ | |||
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /> | |||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> | |||
<section name="oracle.manageddataaccess.client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /> | |||
<section name="casClientConfig" type="DotNetCasClient.Configuration.CasClientConfiguration, DotNetCasClient" /> | |||
</configSections> | |||
<unity configSource="XmlConfig\ioc.config" /> | |||
<connectionStrings configSource="XmlConfig\database.config" /> | |||
@@ -32,6 +33,12 @@ | |||
<httpHandlers> | |||
<add verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" /> | |||
</httpHandlers> | |||
<authentication mode="Forms"> | |||
<forms name=".DotNetCasClientAuth" loginUrl="http://authserver.htpt.edu.cn/authserver/login" timeout="30" defaultUrl="/" cookieless="UseCookies" slidingExpiration="true" path="/" /> | |||
</authentication> | |||
<httpModules> | |||
<add name="DotNetCasClient" type="DotNetCasClient.CasAuthenticationModule,DotNetCasClient" /> | |||
</httpModules> | |||
</system.web> | |||
<entityFramework> | |||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework"> | |||
@@ -55,6 +62,10 @@ | |||
<remove name="TRACEVerbHandler" /> | |||
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" /> | |||
</handlers> | |||
<modules> | |||
<remove name="DotNetCasClient" /> | |||
<add name="DotNetCasClient" type="DotNetCasClient.CasAuthenticationModule,DotNetCasClient" /> | |||
</modules> | |||
</system.webServer> | |||
<system.data> | |||
<DbProviderFactories> | |||
@@ -115,4 +126,5 @@ | |||
</dataSources> | |||
</version> | |||
</oracle.manageddataaccess.client> | |||
<casClientConfig casServerLoginUrl="http://authserver.htpt.edu.cn/authserver/login" casServerUrlPrefix="http://authserver.htpt.edu.cn/authserver/" serverName="http://sxjy.htpt.edu.cn:8000/" notAuthorizedUrl="~/NotAuthorized.aspx" cookiesRequiredUrl="~/CookiesRequired.aspx" redirectAfterValidation="true" gateway="false" renew="false" singleSignOut="true" ticketTimeTolerance="5000" ticketValidatorName="Cas20" serviceTicketManager="CacheServiceTicketManager" gatewayStatusCookieName="CasGatewayStatus" /> | |||
</configuration> |
@@ -3,6 +3,7 @@ | |||
<package id="Antlr" version="3.4.1.9004" targetFramework="net45" /> | |||
<package id="bootstrap" version="3.0.0" targetFramework="net45" /> | |||
<package id="CommonServiceLocator" version="1.3" targetFramework="net45" /> | |||
<package id="DotNetCasClient" version="1.3.2" targetFramework="net461" /> | |||
<package id="EntityFramework" version="6.1.3" targetFramework="net45" /> | |||
<package id="jQuery" version="1.10.2" targetFramework="net45" /> | |||
<package id="jQuery.Validation" version="1.11.1" targetFramework="net45" /> | |||
@@ -9,7 +9,7 @@ | |||
</view> | |||
</view> | |||
<view class="footer"> | |||
<img src="../../static/image/bg3.png" alt="" /> | |||
<!-- <img src="../../static/image/bg3.png" alt="" /> --> | |||
</view> | |||
</view> | |||
</template> | |||
@@ -113,18 +113,43 @@ | |||
}, | |||
methods: { | |||
async getCasLoginInfo() { | |||
let loginResult=null; | |||
const url = new URL(window.location.href); | |||
const params = new URLSearchParams(url.search); | |||
const ticket = params.get('ticket'); | |||
if (ticket) { | |||
console.log("1:",ticket); | |||
let postResult = await this.POST('/api/ht/ticket', { | |||
ticket, | |||
}) | |||
console.log(postResult); | |||
if (postResult[1].data.code == '200') { | |||
loginResult = postResult[1].data.data; | |||
} else { | |||
this.TOAST(postResult[1].data.info); | |||
} | |||
const { | |||
baseinfo, | |||
mpinfo, | |||
post, | |||
role | |||
} = loginResult | |||
const user = { | |||
...baseinfo, | |||
post, | |||
role | |||
} | |||
const token = baseinfo.token | |||
this.SET_GLOBAL('token', token) | |||
this.SET_GLOBAL('loginUser', user) | |||
this.SET_STORAGE('token', token) | |||
this.HIDE_LOADING() | |||
this.TAB_TO('/pages/home') | |||
} else { | |||
let url = encodeURIComponent('http://sxjy.htpt.edu.cn:8000') | |||