private bool NTLogin() { string account = this.Request.ServerVariables["LOGON_USER"]; bool b = YZAuthHelper.IsAuthenticated; string a = YZAuthHelper.LoginUserAccount; if (!String.IsNullOrEmpty(account)) { using (BPMConnection cn = new BPMConnection()) { cn.WebOpenAnonymous(); string regularAccount = null; if (BPM.Client.User.IsAccountExist(cn, account, ref regularAccount) && String.Compare(YZAuthHelper.BPMLogoutLastAccount, regularAccount, true) != 0) { YZAuthHelper.SetAuthCookie(regularAccount); YZAuthHelper.ClearLogoutFlag(); return(true); } else { YZAuthHelper.ClearLogoutFlag(); } } } return(false); }
public virtual JObject LoginTrial(HttpContext context) { YZRequest request = new YZRequest(context); bool isapp = request.GetBool("isapp"); string lang = request.GetString("lang", "zh-chs"); string cordova = request.GetString("cordova"); string model = request.GetString("model"); string name = request.GetString("name", model); string platform = request.GetString("platform"); string uuid = request.GetString("uuid"); string version = request.GetString("version"); string manufacturer = request.GetString("manufacturer"); bool isVirtual = request.GetBool("isVirtual", false); string serial = request.GetString("serial"); string uid = "99199"; string pwd = "1"; string realAccount = null; string token = null; if (!BPMConnection.Authenticate(YZAuthHelper.BPMServerName, YZAuthHelper.BPMServerPort, uid, pwd, out realAccount, out token)) { throw new Exception(Resources.YZStrings.Aspx_Login_Fail); } YZAuthHelper.SetAuthCookie(realAccount, token); YZAuthHelper.SetLangSession(YZCultureInfoParse.Parse(lang, YZCultureInfoParse.DefauleCultureInfo).LCID); YZAuthHelper.ClearLogoutFlag(); JObject rv = this.GenLoginResult(realAccount, true); return(rv); }
protected void Page_Load(object sender, EventArgs e) { userid = Request["uid"]; password = Request["PWD"]; JsonItem rv = new JsonItem(); string realAccount = null; try { if (BPMConnection.Authenticate(YZAuthHelper.BPMServerName, YZAuthHelper.BPMServerPort, userid, password, out realAccount)) { YZAuthHelper.SetAuthCookie(realAccount); YZAuthHelper.ClearLogoutFlag(); rv.Attributes["success"] = true; rv.Attributes["text"] = "登陆成功"; } } catch (Exception ex) { rv.Attributes["success"] = true; rv.Attributes["text"] = ex.Message; } }
private bool SetAuth(string UserAccount) { if (YZAuthHelper.IsAuthenticated) { return(true); } if (!String.IsNullOrEmpty(UserAccount)) { using (BPMConnection cn = new BPMConnection()) { cn.WebOpenAnonymous(); string regularAccount = null; if (BPM.Client.User.IsAccountExist(cn, UserAccount, ref regularAccount)) { YZAuthHelper.SetAuthCookie(regularAccount); YZAuthHelper.ClearLogoutFlag(); return(true); } else { YZAuthHelper.ClearLogoutFlag(); } } } return(false); }
public Result ResetPassword(AuthInfo authInfo, string account, string password) { try { YZService.AuthSystem(authInfo); YZAuthHelper.SetAuthCookie(authInfo.RealLoginAccount); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); string oupath; MemberCollection members = OrgSvr.GetUserPositions(cn, account); if (members.Count == 0) { oupath = cn.GetRootOUs()[0].FullName; } else { oupath = members[0].GetParentOU(cn).FullName; } BPM.Client.User.ResetPassword(cn, oupath, account, password); } return(Result.SuccessResult); } catch (Exception e) { return(Result.FromException(e)); } }
public virtual object Process(HttpContext context) { YZRequest request = new YZRequest(context); int stepid = request.GetInt32("StepID"); string uid = request.GetString("uid", YZAuthHelper.LoginUserAccount); //共享任务uid为空,会导致重定向到登录页面,产生异常 using (BPMConnection cn = new BPMConnection()) { string orguid = YZAuthHelper.LoginUserAccount; YZAuthHelper.SetAuthCookie(uid); try { cn.WebOpen(); } finally { YZAuthHelper.SetAuthCookie(orguid); } ProcessInfo processInfo = BPMProcess.GetProcessInfo(cn, stepid); if (processInfo.Links.Count == 0) { throw new BPMException(BPMExceptionType.MissOutLink, processInfo.NodeName); } string postXml = @"{0} <XForm> <Header> <Method>Process</Method> <PID>{1}</PID> <Action>{2}</Action> <Comment></Comment> </Header> <FormData> </FormData> </XForm>"; postXml = String.Format(postXml, "<?xml version=\"1.0\"?>", stepid, YZUtility.EncodeXMLInnerText(processInfo.Links[0].DisplayString)); using (MemoryStream postStream = new MemoryStream(Encoding.UTF8.GetBytes(postXml))) { PostResult postResult = BPMProcess.Post(cn, postStream); return(new { success = true, result = (postResult.PostResultType == PostResultType.TaskFinishedApproved || postResult.PostResultType == PostResultType.TaskFinishedRejected) ? "finished" : "running" }); } } }
private void SSOAuthLogin(OAuthToken TokenInfo) { #region string //string UID = System.Web.HttpContext.Current.Request.Params["UID"]; //string Pwd = System.Web.HttpContext.Current.Request.Params["Pwd"]; //string DesUrl = System.Web.HttpContext.Current.Request.Params["ReturnURL"]; //string Redirect = "http://www.e.com/HandlerSSO.aspx?UID={0}&Pwd={1}&ReturnURL={2}"; #endregion string UID = TokenInfo.AccountID; string Pwd = TokenInfo.PassWords; string DesUrl = TokenInfo.ReturnURL; string Redirect = String.IsNullOrEmpty(TokenInfo.RedirectURL) ? ConfigHelper.GetConfig("TokenCorrectRedirectURL") : TokenInfo.RedirectURL; if (!string.IsNullOrEmpty(UID)) { string realAccount = null; if (BPMConnection.Authenticate(YZAuthHelper.BPMServerName, YZAuthHelper.BPMServerPort, UID, Pwd, out realAccount)) { YZAuthHelper.SetAuthCookie(realAccount); YZAuthHelper.ClearLogoutFlag(); if (!String.IsNullOrEmpty(DesUrl)) { Response.Redirect(DesUrl); } else { Response.Redirect(Redirect.WithFormat(UID, Pwd, DesUrl)); } } else { Response.Write("BPM验证失败"); } } else { Response.Write("单点登录系统里UID为空"); } }
public Result UpdateUser(AuthInfo authInfo, UserInfo userInfo, string updateFieldName) { try { YZService.AuthSystem(authInfo); YZAuthHelper.SetAuthCookie(authInfo.RealLoginAccount); //传入值检查 if (String.Compare(updateFieldName, "Password") == 0) { throw new Exception(String.Format("属性不支持以更新方式修改:{0}", updateFieldName)); } using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); //获得用户原始信息 User user = new User(); user.Open(cn, userInfo.Account); //粘合新属性 PropertyInfo tagProp = typeof(User).GetProperty(updateFieldName); FieldInfo srcProp = typeof(UserInfo).GetField(updateFieldName); if (tagProp == null || srcProp == null) { throw new Exception(String.Format("无效的属性:{0}", updateFieldName)); } tagProp.SetValue(user, srcProp.GetValue(userInfo), null); //执行更新 BPM.Client.User.Update(cn, user.Account, user); } return(Result.SuccessResult); } catch (Exception e) { return(Result.FromException(e)); } }
public Result AddUser(AuthInfo authInfo, UserInfo userInfo) { try { YZService.AuthSystem(authInfo); YZAuthHelper.SetAuthCookie(authInfo.RealLoginAccount); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); OU.AddMember(cn, YZService.LDAPOU2BPMOUPath(userInfo.LDAPOU), null, userInfo.Member, userInfo.User, null, null, null); } return(Result.SuccessResult); } catch (Exception e) { return(Result.FromException(e)); } }
public virtual JObject DingTalkLogin(HttpContext context) { YZRequest request = new YZRequest(context); string code = request.GetString("code"); string corpId = request.GetString("corpId"); string appSecret = request.GetString("appSecret"); string lang = request.GetString("lang", "zh-chs"); string accesstoken = DingTalkManager.Instance.GetAccessToken(corpId, appSecret); string uid = DingTalkManager.Instance.TryGetUserIdFromCode(accesstoken, code); string regularAccount = null; string linsql = ""; using (IYZAppAdminProvider applogin = IYZAppAdminProviderManager.DefaultProvider) { YZAppAdmin.LoginModule lm = applogin.LoadLogin(); linsql = lm.DdLinkSql; } if (!string.IsNullOrEmpty(linsql)) { string sql = string.Format(linsql, uid); uid = Convert.ToString(DBUtil_APP.GetSingle(sql)); } using (BPMConnection cn = new BPMConnection()) { cn.WebOpenAnonymous(); if (!User.IsAccountExist(cn, uid, ref regularAccount)) { throw new Exception(String.Format("当前钉钉登录用户{0},不是有效的BPM账号!", uid)); } YZAuthHelper.SetAuthCookie(regularAccount); } YZAuthHelper.SetLangSession(YZCultureInfoParse.Parse(lang, YZCultureInfoParse.DefauleCultureInfo).LCID); JObject rv = this.GenLoginResult(regularAccount, false); return(rv); }
private void SSO() { //try //{ string UID = System.Web.HttpContext.Current.Request.Params["UID"]; string Pwd = System.Web.HttpContext.Current.Request.Params["Pwd"]; string DesUrl = System.Web.HttpContext.Current.Request.Params["ReturnURL"]; if (!string.IsNullOrEmpty(UID)) { string realAccount = null; if (BPMConnection.Authenticate(YZAuthHelper.BPMServerName, YZAuthHelper.BPMServerPort, UID, Pwd, out realAccount)) { YZAuthHelper.SetAuthCookie(realAccount); YZAuthHelper.ClearLogoutFlag(); if (!String.IsNullOrEmpty(DesUrl)) { Response.Redirect(DesUrl); } else { Response.Redirect("http://localhost/bpm"); } } else { Response.Write("BPM验证失败"); } } else { Response.Write("单点登录系统里uid为空"); } //} //catch (Exception) //{ //} }
public virtual JObject GetSimulateInfo(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); string permisions = request.GetString("Permisions", null); string uid = request.GetString("uid"); BPMProcStep step; BPMTask task; CommentItemCollection comments; FlowDataSet formdataset; BPMStepCollection steps; ProcessSubModel subModel; JObject perm = null; JObject directSendInfo = null; User user; YZAuthHelper.SetAuthCookie(uid); try { using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); TableIdentityCollection tableIdentities = BPMProcess.GetProcessGlobalTableIdentitys(cn, processName, version); formdataset = DataSourceManager.LoadDataSetSchema(cn, tableIdentities); user = User.TryGetUser(cn, uid); if (user == null) { user = new User(); user.Account = uid; user.DisplayName = "张三"; } } } catch (Exception e) { YZAuthHelper.ClearAuthCookie(); throw e; } task = this.GetSimulateTask(user, processName, version); step = this.GetSimulateStep(task, user); comments = new CommentItemCollection(); steps = this.GetSimulateSteps(task, step, user); subModel = ProcessSubModel.Process; perm = new JObject(); directSendInfo = null; int total = 3; int newMessageCount = 1; //准备返回值 JObject result = new JObject(); JObject jForm = new JObject(); jForm["xclass"] = "YZSoft.form.Form5"; jForm["config"] = new JObject(); result["form"] = jForm; result["subModel"] = subModel.ToString(); result["task"] = this.Serialize(task); result["step"] = this.Serialize(step); result["NodePermisions"] = this.Serialize(NodePermision.Inform); result["Comments"] = step.Comments; result["perm"] = perm; result["socialInfo"] = this.SerializeSocialInfo(total, newMessageCount); result["steps"] = this.SerializeForTrace(steps); result["signcomments"] = JArray.FromObject(comments); result["formdataset"] = this.ToResult(formdataset, true); if (subModel == ProcessSubModel.Process) { result["shareTask"] = step.Share; result["IsConsign"] = step.IsConsignStep; JArray links = new JArray(); result["links"] = links; result["directsend"] = directSendInfo; } return(result); }
public void Login() { YZRequest request = new YZRequest(this.Context); string uid = request.GetString("uid", null); string pwd = request.GetString("uep", null); string keystore = request.GetString("keystore", null); JObject rv = new JObject(); if (String.IsNullOrEmpty(uid) /*|| String.IsNullOrEmpty(pwd)*/) { rv[YZJsonProperty.success] = false; rv["errorMessage"] = Resources.YZStrings.Aspx_Login_EnterAccountTip; } else { try { string realAccount; string token; //用私钥解密 if (!String.IsNullOrEmpty(keystore)) { string privateKey = (string)YZTempStorageManager.CurrentStore.Load(keystore); RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024); rsaProvider.FromXmlString(privateKey); uid = System.Text.Encoding.UTF8.GetString(rsaProvider.Decrypt(Convert.FromBase64String(uid), false)); pwd = System.Text.Encoding.UTF8.GetString(rsaProvider.Decrypt(Convert.FromBase64String(pwd), false)); } if (BPMConnection.Authenticate(YZAuthHelper.BPMServerName, YZAuthHelper.BPMServerPort, uid, pwd, out realAccount, out token)) { YZAuthHelper.SetAuthCookie(realAccount, token); YZAuthHelper.ClearLogoutFlag(); rv[YZJsonProperty.success] = true; rv["errorMessage"] = Resources.YZStrings.Aspx_Login_Success; } else { rv[YZJsonProperty.success] = false; rv["errorMessage"] = Resources.YZStrings.Aspx_Login_Fail; } } catch (Exception exp) { YZEventLog log = new YZEventLog(); log.WriteEntry(exp); rv[YZJsonProperty.success] = false; rv["errorMessage"] = exp.Message; } } this.Response.Clear(); this.Response.Write(rv.ToString(Formatting.Indented, YZJsonHelper.Converters)); this.Response.End(); }
public virtual object Start(HttpContext context) { YZRequest request = new YZRequest(context); Guid draftid = request.GetGuid("draftid", false); string memberfullname = request.GetString("memberfullname"); string uid = request.GetString("uid"); using (BPMConnection cn = new BPMConnection()) { string orguid = YZAuthHelper.LoginUserAccount; YZAuthHelper.SetAuthCookie(uid); try { cn.WebOpen(); } finally { YZAuthHelper.SetAuthCookie(orguid); } BPMDraft draft = new BPMDraft(); draft.Open(cn, draftid); JObject jDraftHeader = null; if (!String.IsNullOrEmpty(draft.Header)) { jDraftHeader = JObject.Parse(draft.Header); } PostInfo postInfo = BPMProcess.GetPostInfo(cn, draft.ProcessName, null, memberfullname, -1); if (postInfo.Links.Count == 0) { throw new BPMException(BPMExceptionType.MissOutLink, postInfo.NodeName); } string postXml = @"{0} <XForm> <Header> <Method>Post</Method> <ProcessName>{1}</ProcessName> <OwnerMemberFullName>{2}</OwnerMemberFullName> <Action>{3}</Action> <Comment>{4}</Comment> {5} </Header> {6} </XForm>"; StringBuilder sb = new StringBuilder(); if (jDraftHeader != null) { foreach (KeyValuePair <string, JToken> jProp in jDraftHeader) { string line = String.Format("<{0}>{1}</{0}>", jProp.Key, YZUtility.EncodeXMLInnerText(jProp.Value.ToString())); sb.AppendLine(line); } } postXml = String.Format(postXml, "<?xml version=\"1.0\"?>", YZUtility.EncodeXMLInnerText(draft.ProcessName), YZUtility.EncodeXMLInnerText(memberfullname), YZUtility.EncodeXMLInnerText(postInfo.Links[0].DisplayString), YZUtility.EncodeXMLInnerText(draft.Comments), sb.ToString(), draft.xml); using (MemoryStream postStream = new MemoryStream(Encoding.UTF8.GetBytes(postXml))) { PostResult postResult = BPMProcess.Post(cn, postStream); return(new { success = true, TaskID = postResult.TaskID, SN = postResult.SN }); } } }
public override void ProcessRequest(HttpContext context) { YZRequest request = new YZRequest(context); try { if (!YZAuthHelper.IsAuthenticated) { string account = request.GetString("UploadAuthorAccount", null); string uploadToken = request.GetString("UploadAuthorToken", null); if (!String.IsNullOrEmpty(account) && !String.IsNullOrEmpty(uploadToken)) { if (YZSecurityHelper.CheckUploadToken(account, uploadToken)) { YZAuthHelper.SetAuthCookie(account); } } } if (!YZAuthHelper.IsAuthenticated) { JObject rv = new JObject(); rv["success"] = false; rv["errorMessage"] = Resources.YZStrings.Aspx_Upload_NoAuth; context.Response.Write(rv.ToString()); return; } HttpFileCollection files = context.Request.Files; if (files.Count > 0 && files[0].ContentLength > 0) { HttpPostedFile file = files[0]; string fileName = System.IO.Path.GetFileName(file.FileName); long fileSize = file.ContentLength; string fileExt = System.IO.Path.GetExtension(fileName).ToLower(); string method = request.GetString("Method", "SaveAttachment"); if (!YZNameChecker.IsValidMethodName(method)) { throw new Exception("Invalid method name"); } Type type = this.GetType(); System.Reflection.MethodInfo methodcall = type.GetMethod(method, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public); if (methodcall == null) { throw new Exception(String.Format(Resources.YZStrings.Aspx_UnknowCommand, method)); } object rv; try { rv = methodcall.Invoke(this, new object[] { context, file, fileName, fileSize, fileExt }); } catch (Exception exp) { throw exp.InnerException; } JToken jToken; if (rv == null) { jToken = new JObject(); jToken["success"] = true; } else if (rv is JToken) { jToken = rv as JToken; } else { if (rv is string) { jToken = JValue.FromObject(rv); } else if (rv is IEnumerable) { jToken = JArray.FromObject(rv); } else { jToken = JValue.FromObject(rv); } } context.Response.Write(jToken.ToString(Formatting.Indented, request.Converters)); } else { JObject rv = new JObject(); rv[YZJsonProperty.success] = false; rv[YZJsonProperty.errorMessage] = Resources.YZStrings.Aspx_Invalid_File; context.Response.Write(rv.ToString(Formatting.Indented, request.Converters)); } } catch (Exception exp) { JObject rv = new JObject(); rv[YZJsonProperty.success] = false; rv[YZJsonProperty.errorMessage] = HttpUtility.HtmlEncode(exp.Message) /* + exp.StackTrace*/; context.Response.Write(rv.ToString(Formatting.Indented, request.Converters)); } }
public virtual JObject Login(HttpContext context) { YZRequest request = new YZRequest(context); string lang = request.GetString("lang", "zh-chs"); string uid = request.GetString("uid"); string pwd = request.GetString("pwd", null); bool isapp = request.GetBool("isapp"); string cordova = request.GetString("cordova"); string model = request.GetString("model"); string name = request.GetString("name", model); string platform = request.GetString("platform"); string uuid = request.GetString("uuid"); string version = request.GetString("version"); string manufacturer = request.GetString("manufacturer"); bool isVirtual = request.GetBool("isVirtual", false); string serial = request.GetString("serial"); bool validationPanelShow = request.GetBool("validationPanelShow"); string smsGuid = request.GetString("smsGuid", null); string vcode = request.GetString("vcode", null); string keystore = request.GetString("keystore", null); //用私钥解密 if (!String.IsNullOrEmpty(keystore)) { string privateKey = (string)YZTempStorageManager.CurrentStore.Load(keystore); RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024); rsaProvider.FromXmlString(privateKey); uid = System.Text.Encoding.UTF8.GetString(rsaProvider.Decrypt(Convert.FromBase64String(uid), false)); pwd = System.Text.Encoding.UTF8.GetString(rsaProvider.Decrypt(Convert.FromBase64String(pwd), false)); } Device device = null; SMS sms = null; JObject rv; if (isapp) { using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { device = DeviceManager.TryGetDevice(provider, cn, uid, uuid); } } //设备禁用 if (device != null && device.Disabled) { rv = new JObject(); rv[YZJsonProperty.success] = false; rv["prompt"] = true; rv[YZJsonProperty.errorMessage] = Resources.YZMobile.Aspx_Auth_DeviceDisabled; return(rv); } //账号保护 if (device == null) { bool IsAppLoginProtected; using (BPMConnection cn = new BPMConnection()) { cn.WebOpenAnonymous(); IsAppLoginProtected = User.IsAppLoginProtected(cn, uid); } if (IsAppLoginProtected) { if (!validationPanelShow) { rv = new JObject(); rv[YZJsonProperty.success] = false; rv["needSmsValidation"] = true; rv[YZJsonProperty.errorMessage] = Resources.YZMobile.Aspx_Auth_StrangerDevice; return(rv); } if (String.IsNullOrEmpty(smsGuid)) { throw new Exception(Resources.YZMobile.Aspx_Auth_GetValidationCodeFirst); } using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { sms = SMSManager.TryGetSMS(provider, cn, smsGuid); } } if (sms == null) { throw new Exception(Resources.YZMobile.Aspx_Auth_GetValidationCodeAgain); } if (sms.ValidationCode != vcode) { throw new Exception(Resources.YZMobile.Aspx_Auth_IncorrectValidationCode); } if (sms.ExpireDate < DateTime.Now) { throw new Exception(Resources.YZMobile.Aspx_Auth_GetValidationCodeAgain); } } } } if (String.IsNullOrEmpty(uid) /*|| String.IsNullOrEmpty(password)*/) { throw new Exception(Resources.YZStrings.Aspx_Login_EnterAccountTip); } string realAccount = null; string token = null; if (!BPMConnection.Authenticate(YZAuthHelper.BPMServerName, YZAuthHelper.BPMServerPort, uid, pwd, out realAccount, out token)) { throw new Exception(Resources.YZStrings.Aspx_Login_Fail); } YZAuthHelper.SetAuthCookie(realAccount, token); YZAuthHelper.SetLangSession(YZCultureInfoParse.Parse(lang, YZCultureInfoParse.DefauleCultureInfo).LCID); YZAuthHelper.ClearLogoutFlag(); rv = this.GenLoginResult(realAccount, false); //登录成功后处理 if (isapp) { using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { if (device != null) { device.LastLogin = DateTime.Now; DeviceManager.Update(provider, cn, device); } else { device = new Device(); device.Account = realAccount; device.UUID = uuid; device.Name = name; device.Model = model; device.Description = String.Format("{0} {1} {2} {3}", manufacturer, model, platform, version); device.Disabled = false; device.RegisterAt = DateTime.Now; device.LastLogin = device.RegisterAt; DeviceManager.Insert(provider, cn, device); } if (sms != null) { SMSManager.DeleteSMS(provider, cn, sms.ItemGUID); } } } } return(rv); }
protected void Page_Load(object sender, EventArgs e) { string code = this.Request.Params["code"]; string app = this.Request.Params["app"]; string linsql = ""; using (IYZAppAdminProvider applogin = IYZAppAdminProviderManager.DefaultProvider) { YZAppAdmin.LoginModule lm = applogin.LoadLogin(); if (lm.WxLogin != "1") { this.Response.Clear(); this.Response.Write("<script>alert('未开启微信登陆')</script>"); return; } wechat.corpId = lm.WxId; wechat.agentId = lm.WxAgentId; wechat.secret = lm.WxSecret; linsql = lm.WxLinkSql; } if (String.IsNullOrEmpty(app)) { app = "main"; } if (String.IsNullOrEmpty(code)) { YZUrlBuilder uri = new YZUrlBuilder("https://open.weixin.qq.com/connect/oauth2/authorize"); uri.QueryString["appid"] = wechat.corpId; uri.QueryString["response_type"] = "code"; uri.QueryString["redirect_uri"] = this.Request.Url.ToString(); uri.QueryString["scope"] = "SCOPE"; uri.QueryString["state"] = "STATE#wechat_redirect"; this.Response.Redirect(uri.ToString()); } else { try { JObject jApp = jApps[app] as JObject; string accesstoken = WeChatManager.Instance.GetAccessToken(wechat.corpId, wechat.secret); string userid = WeChatManager.Instance.TryGetUserIdFromCode(accesstoken, code); string ticket = WeChatManager.Instance.GetJSapiTicket(accesstoken); string timeStamp = WeChatManager.Instance.GetTimeStamp(); string nonceStr = YZSecurityHelper.SecurityKey; string url = this.Request.Url.ToString(); string signature = WeChatManager.Instance.GenSigurate(nonceStr, timeStamp, ticket, url); if (String.IsNullOrEmpty(userid)) { throw new Exception("非企业号用户!"); } if (!string.IsNullOrEmpty(linsql)) { string sql = string.Format(linsql, userid); userid = Convert.ToString(DBUtil_APP.GetSingle(sql)); } using (BPMConnection cn = new BPMConnection()) { cn.WebOpenAnonymous(); string regularAccount = null; if (!BPM.Client.User.IsAccountExist(cn, userid, ref regularAccount)) { throw new Exception(String.Format("当前企业号登录用户{0},不是有效的BPM账号!", userid)); } YZAuthHelper.SetAuthCookie(regularAccount); this.Title = (string)jApp["title"]; JObject jAppResult = new JObject(); jAppResult["app"] = app; jAppResult["agentId"] = wechat.agentId; jAppResult["secret"] = wechat.secret; jAppResult["title"] = jApp["title"]; jAppResult["corpId"] = corpId; jAppResult["timeStamp"] = timeStamp; jAppResult["nonceStr"] = nonceStr; jAppResult["signature"] = signature; jAppResult["jsApiList"] = jApp["jsApiList"]; jAppResult["xclass"] = jApp["xclass"]; JObject jConfig = jApp["config"] == null ? new JObject() : JObject.FromObject(jApp["config"]); jAppResult["config"] = jConfig; foreach (string key in this.Request.QueryString.Keys) { jConfig[key] = this.Request.QueryString[key]; } this._litApp.Text = jAppResult.ToString(Formatting.Indented, YZJsonHelper.Converters); } } catch (Exception exp) { if (exp.Message.Contains("query?e=40029")) { YZUrlBuilder uri = new YZUrlBuilder("https://open.weixin.qq.com/connect/oauth2/authorize"); uri.QueryString["appid"] = wechat.corpId; uri.QueryString["response_type"] = "code"; string url = this.Request.Url.ToString(); int code2 = url.IndexOf("code"); url = url.Substring(0, code2 - 1); uri.QueryString["redirect_uri"] = url; uri.QueryString["scope"] = "SCOPE"; uri.QueryString["state"] = "STATE#wechat_redirect"; this.Response.Redirect(uri.ToString()); } else { this.Response.Redirect("~/YZSoft/assist/AspxError/default.aspx?err=" + HttpUtility.UrlEncode(exp.Message)); } } } }
protected void Page_Load(object sender, EventArgs e) { if (String.Compare(System.Web.Configuration.WebConfigurationManager.AppSettings["ShowMaintenancePage"], "true", true) == 0) { Response.Redirect("~/YZSoft/core/Maintenance/Default.aspx"); } bool webLogin = String.Compare(WebConfigurationManager.AppSettings["WebLoginEnable"], "false", true) == 0 ? false : true; bool ntLogin = String.Compare(WebConfigurationManager.AppSettings["NTLoginEnable"], "false", true) == 0 ? false : true; string action = this.Request.Params["action"]; if (action == "login") { string type = this.Request.Params["type"]; JsonItem rv = new JsonItem(); if (type == "NT") //NT登录 { try { if (this.NTLogin()) { rv[YZJsonProperty.success] = true; rv["text"] = Resources.YZStrings.Aspx_Login_Success; } } catch (Exception exp) { rv[YZJsonProperty.success] = false; rv["text"] = exp.Message; } if (rv.Attributes.ContainsKey(YZJsonProperty.success)) { Response.Clear(); this.Response.Write(rv.ToString()); Response.End(); } else { this.Response.Clear(); this.Response.Status = "401 Unauthorized"; this.Response.AppendHeader("WWW-Authenticate", "NTLM");//Basic, Digest, NTLM, and Negotiate this.Response.End(); } } else //BPM 登录 { string userid = this.Request.Params["uid"]; string password = this.Request.Params["pwd"]; string positionid = this.Request.Params["posid"]; if (String.IsNullOrEmpty(userid) /*|| String.IsNullOrEmpty(password)*/) { rv[YZJsonProperty.success] = false; rv["text"] = Resources.YZStrings.Aspx_Login_EnterAccountTip; } else if (String.IsNullOrEmpty(positionid)) { rv[YZJsonProperty.success] = false; rv["text"] = Resources.YZStrings.Aspx_Login_SelPosTip; } else { try { string realAccount; string token; if (BPMConnection.Authenticate(YZAuthHelper.BPMServerName, YZAuthHelper.BPMServerPort, userid, password, out realAccount, out token)) { YZAuthHelper.SetAuthCookie(realAccount, token); YZAuthHelper.ClearLogoutFlag(); rv[YZJsonProperty.success] = true; rv["text"] = Resources.YZStrings.Aspx_Login_Success; } else { rv[YZJsonProperty.success] = false; rv["text"] = Resources.YZStrings.Aspx_Login_Fail; } } catch (Exception exp) { YZEventLog log = new YZEventLog(); log.WriteEntry(exp); rv[YZJsonProperty.success] = false; rv["text"] = exp.Message; } } Response.Clear(); Response.Write(rv.ToString()); Response.End(); } } else if (action == "logout") { YZAuthHelper.SignOut(); YZAuthHelper.SetLogoutFlag("logout", String.Empty); string ssoUrl = System.Configuration.ConfigurationManager.AppSettings["ssoUrl"]; if (String.IsNullOrEmpty(ssoUrl)) { ssoUrl = "~/"; //ssoUrl = "~/YZSoft/Login/"; } this.Response.Redirect(ssoUrl, true); } else if (action == "changeuser") { YZAuthHelper.SignOut(); YZAuthHelper.SetLogoutFlag("changeuser", YZAuthHelper.LoginUserAccount); string ssoUrl = System.Configuration.ConfigurationManager.AppSettings["ssoUrl"]; if (String.IsNullOrEmpty(ssoUrl)) { ssoUrl = "~/"; //ssoUrl = "~/YZSoft/Login/"; } this.Response.Redirect(ssoUrl, true); } else { string ssoUrl = WebConfigurationManager.AppSettings["ssoUrl"]; if (!String.IsNullOrEmpty(ssoUrl)) { Response.Redirect(ssoUrl, true); } if (ntLogin && !webLogin) //仅NT登录 { if (YZAuthHelper.BPMLogoutType != "logout" && YZAuthHelper.BPMLogoutType != "changeuser") //非登出情况下 { if (this.NTLogin()) //NT登录成功 { if (!String.IsNullOrEmpty(Request.QueryString["ReturnURL"])) { Response.Redirect(Request.QueryString["ReturnURL"]); } else { Response.Redirect("~/"); } return; } if (String.IsNullOrEmpty(this.Request.ServerVariables["LOGON_USER"])) { this.Response.Clear(); this.Response.Status = "401 Unauthorized"; this.Response.AppendHeader("WWW-Authenticate", "NTLM");//Basic, Digest, NTLM, and Negotiate this.Response.End(); return; } } } //页标题 this.Page.Title = System.Web.Configuration.WebConfigurationManager.AppSettings["CompanyInfoLoginPageTitle"]; if (String.IsNullOrEmpty(this.Page.Title)) { this.Page.Title = Resources.YZStrings.Aspx_Login_Title; } //根据启动程序应用Css string startApp = System.Web.Configuration.WebConfigurationManager.AppSettings["StartApp"]; if (String.IsNullOrEmpty(startApp)) { startApp = "YZApp"; } this._litLoginCss.Text = String.Format("<link href=\"../../../{0}/Styles/login.css\" rel=\"stylesheet\" type=\"text/css\" />", startApp); //显示文字 this._litBoxCaption.Text = Resources.YZStrings.Aspx_Login_BoxCaption; this._litAccount.Text = Resources.YZStrings.Aspx_Login_Account; this._lnkRegNewAccount.Text = Resources.YZStrings.Aspx_Login_RegNewAccount; this._litPwd.Text = Resources.YZStrings.Aspx_Login_Pwd; this._lnkForgotPwd.Text = Resources.YZStrings.Aspx_Login_ForgotPwd; this._btnLogin.Value = Resources.YZStrings.Aspx_Login_BtnLogin; this._btnNTLogin.Value = Resources.YZStrings.Aspx_Login_BtnNTLogin; string[] strLcids = Resources.YZStrings.All_Languages.Split(new char[] { ',', ';' }); Type resType = typeof(Resources.YZStrings); ResourceManager mgr = new ResourceManager(resType.FullName, resType.Assembly); List <String> langs = new List <string>(); foreach (string strLcid in strLcids) { string resName = "All_Languages_" + strLcid; string langName = mgr.GetString(resName); bool current = String.Compare(langName, Resources.YZStrings.All_Languages_Cur, 0) == 0; langs.Add(String.Format("<a href=\"#\" class=\"yz-login-lang-item {0}\" onclick=\"changeLanguage('{1}');\">{2}</a>", current ? "yz-login-lang-item-selected" : "", strLcid, langName)); } this._litChangeLang.Text = String.Join("<span class=\"yz-login-lang-sp\">|</span>", langs.ToArray()); //关闭用户注册,忘记密码链接 //this._lnkRegNewAccount.Enabled = false; //this._lnkForgotPwd.Enabled = false; this._lnkRegNewAccount.Visible = false; this._lnkForgotPwd.Visible = false; this._litStep2Caption.Text = Resources.YZStrings.Aspx_Login_Step2_BoxCaption; this._litStep2Msg.Text = String.Format(Resources.YZStrings.Aspx_Login_Step2_Msg, "<span class=\"point\">●</span>"); this._litStep1Caption.Text = Resources.YZStrings.Aspx_Login_Step1_BoxCaption; this._litStep1Msg.Text = Resources.YZStrings.Aspx_Login_Step1_Msg; this._litStep1InsCurStep0.Text = Resources.YZStrings.Aspx_Login_Step1_Install_CurStep; this._litStep1InsCurStep1.Text = Resources.YZStrings.Aspx_Login_Step1_Install_CurStep; this._litStep1InsCurStep2.Text = Resources.YZStrings.Aspx_Login_Step1_Install_CurStep; this._litStep1InsCurStep3.Text = Resources.YZStrings.Aspx_Login_Step1_Install_CurStep; this._litStep1InsCurStep4.Text = Resources.YZStrings.Aspx_Login_Step1_Install_CurStep; this._litStep1NotInstalled.Text = Resources.YZStrings.Aspx_Login_Step1_Install_NotInstalled; this._litStep1InstallNow.Text = Resources.YZStrings.Aspx_Login_Step1_Install_InstallNow; this._litStep1Installing.Text = Resources.YZStrings.Aspx_Login_Step1_Install_Installing; this._litStep1Installing1.Text = Resources.YZStrings.Aspx_Login_Step1_Install_Installing; this._litStep1PlsWaiting.Text = Resources.YZStrings.Aspx_Login_Step1_Install_PlsWaiting; this._litStep1InstallFinished.Text = Resources.YZStrings.Aspx_Login_Step1_Install_InstallFinished; this._litStep1CheckAgain.Text = Resources.YZStrings.Aspx_Login_Step1_Install_CheckAgain; this._litStep1InstallFailed.Text = Resources.YZStrings.Aspx_Login_Step1_Install_InstallFailed; this._litStep1Retry.Text = Resources.YZStrings.Aspx_Login_Step1_Install_Retry; this._litStep1InstallSucceed.Text = Resources.YZStrings.Aspx_Login_Step1_Install_InstallSucceed; this._litStep1LoginContinue.Text = Resources.YZStrings.Aspx_Login_Step1_Login_Continue; this._litStep1Ignore.Text = Resources.YZStrings.Aspx_Login_Step1_Ignore; this._litStep0Caption.Text = Resources.YZStrings.Aspx_Login_Step0_BoxCaption; this._litStep0Msg.Text = Resources.YZStrings.Aspx_Login_Step0_Msg; this._litStep0Skip.Text = Resources.YZStrings.Aspx_Login_Step0_Skip; this._litStep0Skip1.Text = Resources.YZStrings.Aspx_Login_Step0_Skip; this._litStep0DownloadBrowser.Text = Resources.YZStrings.Aspx_Login_Step0_DownloadBrowser; this._downloadXP.Text = Resources.YZStrings.Aspx_Login_Step0_Download; this._downloadVista.Text = Resources.YZStrings.Aspx_Login_Step0_Download; this._download2003.Text = Resources.YZStrings.Aspx_Login_Step0_Download; this._downloadMore.Text = Resources.YZStrings.Aspx_Login_Step0_Download_More; //JS文字 JsonItem jsonStrings = new JsonItem(); jsonStrings.Attributes.Add("Account", YZAuthHelper.LoginUserAccount); jsonStrings.Attributes.Add("SelPos", Resources.YZStrings.Aspx_Login_SelPos); jsonStrings.Attributes.Add("SelPosTip", Resources.YZStrings.Aspx_Login_SelPosTip); jsonStrings.Attributes.Add("EnterAccountTip", Resources.YZStrings.Aspx_Login_EnterAccountTip); jsonStrings.Attributes.Add("EnterPwdTip", Resources.YZStrings.Aspx_Login_EnterPwdTip); jsonStrings.Attributes.Add("BrowserNameOpera", Resources.YZStrings.Aspx_BrowserNameOpera); jsonStrings.Attributes.Add("BrowserNameSafari", Resources.YZStrings.Aspx_BrowserNameSafari); jsonStrings.Attributes.Add("BrowserNameGoogle", Resources.YZStrings.Aspx_BrowserNameGoogle); jsonStrings.Attributes.Add("BrowserNameFirefox", Resources.YZStrings.Aspx_BrowserNameFirefox); jsonStrings.Attributes.Add("BrowserNameOther", Resources.YZStrings.Aspx_BrowserNameOther); jsonStrings.Attributes.Add("BrowserWarning", Resources.YZStrings.Aspx_Login_BrowserWarning); jsonStrings.Attributes.Add("Unknow", Resources.YZStrings.Aspx_Login_Unknow); jsonStrings.Attributes.Add("HttpErr", Resources.YZStrings.Aspx_Login_HttpErr); HtmlGenericControl jsstrs = new HtmlGenericControl("script"); jsstrs.Attributes["type"] = "text/javascript"; jsstrs.InnerHtml = String.Format("var Strings = {0}", jsonStrings.ToString()); this.Page.Header.Controls.AddAt(1, jsstrs); //地图信息 JArray factorys; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { factorys = provider.GetFactorys(cn); } } string returnUrl = String.Empty; if (!String.IsNullOrEmpty(Request.QueryString["ReturnURL"])) { returnUrl = this.ResolveClientUrl(Request.QueryString["ReturnURL"]); } else { returnUrl = this.ResolveClientUrl("~/"); } HtmlGenericControl js = new HtmlGenericControl("script"); js.Attributes["type"] = "text/javascript"; js.InnerHtml = "var _FactoryData=" + factorys.ToString() + ";\n" + "var returnUrl=\"" + YZUtility.EncodeJsString(returnUrl) + "\";"; this.Page.Header.Controls.AddAt(1, js); if (!webLogin) { this._txtUserId.Enabled = false; this._txtPassword.Enabled = false; this._txtUserId.CssClass = "input input-disabled"; this._txtPassword.CssClass = "input input-disabled"; this._lnkRegNewAccount.Enabled = false; this._lnkForgotPwd.Enabled = false; this._btnLogin.Disabled = true; } if (!ntLogin) { this._btnNTLogin.Disabled = true; } } }
public virtual JObject GetSimulateForm(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); string uid = request.GetString("uid"); BPMProcStep step; BPMTask task; MobileFormSetting formSetting; FlowDataSet formdataset; CommentItemCollection comments; User user; YZAuthHelper.SetAuthCookie(uid); try { using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); TableIdentityCollection tableIdentities = BPMProcess.GetProcessGlobalTableIdentitys(cn, processName, version); formdataset = DataSourceManager.LoadDataSetSchema(cn, tableIdentities); user = User.TryGetUser(cn, uid); if (user == null) { user = new User(); user.Account = uid; user.DisplayName = "张三"; } } } catch (Exception e) { YZAuthHelper.ClearAuthCookie(); throw e; } task = this.GetSimulateTask(user, processName, version); step = this.GetSimulateStep(task, user); JObject post = request.GetPostData <JObject>(); if (post != null) { formSetting = post.ToObject <MobileFormSetting>(); } else { formSetting = new MobileFormSetting(); } comments = new CommentItemCollection(); for (int i = 0; i < formdataset.Tables.Count; i++) { FlowDataTable table = formdataset.Tables[i]; if (!table.IsRepeatableTable) { table.Rows.Add(this.CreateNewRow(table, i, 0)); } else { table.Rows.Add(this.CreateNewRow(table, i, 0)); table.Rows.Add(this.CreateNewRow(table, i, 1)); } } //附件的演示数据会导致错误(附件ID没有),必须处理(将附件数据置空) foreach (FlowDataTable table in formSetting.ControlDataSet.Tables) { FlowDataTable dataTable = formdataset.Tables.TryGetTable(table.TableName); if (dataTable != null) { foreach (FlowDataColumn column in table.Columns) { if (column.MapTo == "YZSoft$ux.field.Attachment") { foreach (FlowDataRow row in dataTable.Rows) { row[column.ColumnName] = ""; //不能设置null,设置null附件控件表现形式不同 } } } } } this.ParseMobileFormSetting(formSetting); //准备返回值 JObject result = new JObject(); //填充form域(表单信息) JObject fieldset; JArray items; JObject field; JObject form = new JObject(); result["form"] = form; JArray formitems = new JArray(); form["items"] = formitems; //基本信息的fieldset填充 fieldset = new JObject(); formitems.Add(fieldset); fieldset["xtype"] = "fieldset"; fieldset["innerName"] = "Header"; //fieldset["title", "基本信息"); items = new JArray(); fieldset["items"] = items; field = new JObject(); items.Add(field); field["xclass"] = "YZSoft.form.FormHeader"; field["padding"] = "16 10 10 16"; field["task"] = this.Serialize(task); field = new JObject(); items.Add(field); field["xclass"] = "Ext.field.Field"; field["label"] = Resources.YZMobile.Aspx_FormData_StepName; field["html"] = step.StepDisplayName; field = new JObject(); items.Add(field); field["xclass"] = "Ext.field.Field"; field["label"] = Resources.YZMobile.Aspx_FormData_Date; field["html"] = YZStringHelper.DateToStringL(task.CreateAt); field = new JObject(); items.Add(field); field["xclass"] = "Ext.field.Field"; field["label"] = Resources.YZMobile.Aspx_FormData_Desc; field["html"] = task.Description; //应用移动表单设定字段 - 非可重复表 this.ApplyMasterFields(Model.Process, form, formitems, task, step, formSetting, formdataset); //应用移动表单设定字段 - 可重复表 this.ApplyDetailFields(Model.Process, form, formitems, task, step, formSetting, formdataset); //自定义信息 this.ApplyCustomFields(Model.Process, form, formitems, task, step, formdataset, comments); //控件测试 //this.AddTestingFields(Model.Process, form, formitems, task, step, formdataset, comments); return(result); }
public void ProcessRequest(HttpContext context) { JsonItem rv = new JsonItem(); string userid = context.Request.Params["uid"]; string password = context.Request.Params["pwd"]; string isWeixIn = context.Request.Params["isWeixIn"]; LoginUser loginUers = new LoginUser(); String NetWork = String.IsNullOrEmpty(context.Request.Params["NetWork"]) ? "" : context.Request.Params["NetWork"], Phone = String.IsNullOrEmpty(context.Request.Params["DevicePlatform"]) ? "" : context.Request.Params["DevicePlatform"], DeviceName = String.IsNullOrEmpty(context.Request.Params["DeviceName"]) ? "" : context.Request.Params["DeviceName"], UUID = String.IsNullOrEmpty(context.Request.Params["UUID"]) ? "" : context.Request.Params["UUID"], Versions = String.IsNullOrEmpty(context.Request.Params["Version"]) ? "Web客户端" : context.Request.Params["Version"], strErrorMsg = String.Empty; try { if (String.IsNullOrEmpty(userid) /*|| String.IsNullOrEmpty(password)*/) { if (String.IsNullOrWhiteSpace(isWeixIn)) { throw new Exception(JosonStrings.Aspx_Login_EnterAccountTip); } else { throw new Exception("请关注微信服务号【创维数字移动办公】后,绑定你的域账号!"); } } string realAccount = null; if (!String.IsNullOrEmpty(isWeixIn)) { var isDegug = Convert.ToString(context.Request.Params["isDebug"]).ToLower().Equals("true"); if (context.Request.UserAgent.ToLower().Contains("micromessenger")) { realAccount = userid; Versions = "微信客户端"; } else { if (!isDegug) { rv.Attributes["success"] = false; rv.Attributes["errorMessage"] = "试图非法登录!本次已经记录该操作!客户端仅提供微信绑定域用户使用" + DeviceName + Phone + NetWork; context.Response.Write(rv.ToString()); } else { realAccount = userid; Versions = "微信客户端"; } } } else { if (!BPMConnection.Authenticate(YZAuthHelper.BPMServerName, YZAuthHelper.BPMServerPort, userid, password, out realAccount)) { throw new Exception(JosonStrings.Aspx_Login_Fail); } } if (realAccount != null) { YZAuthHelper.SetAuthCookie(realAccount); YZAuthHelper.ClearLogoutFlag(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User user = User.FromAccount(cn, realAccount); loginUers = cn.getLoginUser(userid, password, "LogIn", "logInOK", NetWork, Phone, UUID, DeviceName, Versions); JsonItem juser = new JsonItem(); rv.Attributes["user"] = juser; juser.Attributes["Account"] = user.Account; string andriodPushService = WebConfigurationManager.AppSettings["AndroidPushService"]; juser.Attributes["AndroidPushService"] = String.IsNullOrEmpty(andriodPushService) ? "JPush" : andriodPushService; juser.Attributes["HRID"] = user.HRID; juser.Attributes["DisplayName"] = user.DisplayName; juser.Attributes["ShortName"] = YZStringHelper.GetUserShortName(user.Account, user.DisplayName); juser.Attributes["LongName"] = YZStringHelper.GetUserFriendlyName(user.Account, user.DisplayName); DateTime today = DateTime.Today; juser.Attributes["LoginDate"] = String.Format("{0}年{1}月{2}日", today.Year, today.Month, today.Day); juser.Attributes["NetWork"] = NetWork; juser.Attributes["Phone"] = Phone; juser.Attributes["UUID"] = UUID; juser.Attributes["DeviceName"] = DeviceName; } new SqlServerProvider(context).InsertLogInInfo(loginUers); //System.Threading.Thread.Sleep(500); rv.Attributes["success"] = true; context.Response.Write(rv.ToString()); } } catch (Exception exp) { YZEventLog log = new YZEventLog(); log.WriteEntry(exp); loginUers.ErrorMsg = exp.Message; rv.Attributes["success"] = false; rv.Attributes["errorMessage"] = exp.Message; context.Response.Write(rv.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { if (!YZAuthHelper.IsAuthenticated) { string token = this.Request.QueryString["Token"]; if (!String.IsNullOrEmpty(token)) { using (SqlConnection cn = new SqlConnection()) { cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["BPMDB"].ConnectionString; cn.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = cn; cmd.CommandText = "SELECT StepID,Account,hash FROM BPMInstProcessToken WHERE Token=@Token"; cmd.Parameters.Add("@Token", SqlDbType.NVarChar).Value = token; using (DBReader reader = new DBReader(cmd.ExecuteReader())) { if (reader.Read()) { int stepid = Int32.Parse(this.Request.QueryString["pid"]); int stepidSaved = reader.ReadInt32(0); string account = reader.ReadString(1); string hash = reader.ReadString(2); if (stepid == stepidSaved) { List <string> values = new List <string>(); values.Add(token); values.Add(stepid.ToString()); values.Add(account); if (YZSecurityHelper.CheckHash(values, hash, YZSecurityHelper.SecurityKey)) { YZAuthHelper.SetAuthCookie(account); } } } } } } } } if (!YZAuthHelper.IsAuthenticated) { FormsAuthentication.RedirectToLoginPage(); return; } int pid = Int32.Parse(this.Request["pid"]); BPM.Client.ProcessInfo processInfo; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); //如果是共享任务,表单打开时直接获取共享任务 //BPMProcStep step = BPMProcStep.Load(cn,pid); //if (step.Share) // BPMProcStep.PickupShareStep(cn, pid); processInfo = BPMProcess.GetProcessInfo(cn, pid); } if (String.IsNullOrEmpty(processInfo.FormFile)) { throw new Exception(Resources.YZStrings.Aspx_Process_MissForm); } else { YZUrlBuilder urlBuilder = YZUtility.GetFormRedirectUrl(this.Page, processInfo.FormFile); this.Response.Redirect(urlBuilder.ToString(), true); } }