private void OnAuthenticated(object sender, AuthenticatedEventArgs e) { //如果身份验证失败则退出 if (!e.IsAuthenticated) { return; } //获取当前登录用户所对应的用户配置对象 var userProfile = this.GetUserProfile(e.User.UserId); //如果对应的用户配置对象没有存在则新增一个 if (userProfile == null) { uint siteId = 0; if (uint.TryParse(e.User.PrincipalId, out siteId)) { userProfile = new UserProfile(e.User.UserId, siteId); this.DataAccess.Insert(userProfile); } } //设置当前用户的扩展属性 e.Parameters.Add("Community.UserProfile", userProfile); }
private void OAuthManagerAuthenticated(object sender, AuthenticatedEventArgs e) { var authenticatedUser = e.AuthenticatedUser; this._userRepository.Save(authenticatedUser); CallApplyUser(authenticatedUser); }
void OnAuthenticated(object sender, AuthenticatedEventArgs e) { if (OnAuthSucceed != null) { OnAuthSucceed(Account); } }
void OnAuthenticated(object sender, AuthenticatedEventArgs e) { if (Account.AuthErrorDate.HasValue) { mailBoxManager.SetMailboxAuthError(Account, false); } }
protected void HandleTokenAuthenticated(AuthenticatedEventArgs e) { if (Authenticated != null) { Authenticated(new AuthenticatedEventArgs()); } }
public void TestAuthenticatedEventArgs() { var args = new AuthenticatedEventArgs("Access Granted."); Assert.AreEqual("Access Granted.", args.Message); Assert.Throws <ArgumentNullException> (() => new AuthenticatedEventArgs(null)); }
/// <summary> /// Handles the <see cref="E:Authenticated" /> event. /// </summary> /// <param name="sender">The sender.</param> /// <param name="authenticatedEventArgs">The <see cref="AuthenticatedEventArgs"/> instance containing the event data.</param> private void OnAuthenticated(object sender, AuthenticatedEventArgs authenticatedEventArgs) { this.AuthenticationResult = authenticatedEventArgs.AuthenticationResult; this.cookieContainer.Add(new Cookie(JasperCookieKey, this.AuthenticationResult.Token) { Domain = JasperCookieKey }); }
protected virtual void OnAuthenticated(AuthenticatedEventArgs e) { EventHandler <AuthenticatedEventArgs> handler = Authenticated; if (handler != null) { handler(this, e); } }
private void OnIsAuthenticatedChanged(AuthenticatedEventArgs e) { if (e.IsAuthenticated) { Login(); } else { Logout(); } }
private void OnAuthFeedback(object o, AuthenticatedEventArgs e) { if (e.Accepted) { //We have been authenticated with the server. spState.Text = "Authenticated with server."; //Send a command to ask for a user list (opcode = "23", no fields). e.ServerConnection.SendUnreliableCommand(0, "23", new string[0]); //Select the chat page tcMain.SelectedIndex = 1; txtSend.Focus( ); } else { //The server didn't like our login details for some reason. spState.Text = "Authentication failed - " + e.Reason; } }
/// <summary> /// Server has accepted or rejected our login details. /// </summary> private void m_UDP_OnAuthFeedback(object o, AuthenticatedEventArgs e) { this.Invoke(new GenesisCore.AuthenticatedHandler(OnAuthFeedback), new object[] { o, e }); }
public void On_pop3Client_Authenticated(object sender, AuthenticatedEventArgs e) { log.Debug(String.Format("Autenticato. Host: {0} - User: {1} - Password: {2}", e.Host, e.Username, e.Password)); }
private void Notify_Authenticated(object sender, AuthenticatedEventArgs e) { this.openId = e.OpenId; this.Parameters.Add("CurrentOpenId", e.OpenId); this.openIdHF.Value = Globals.StripAllTags(this.Parameters["CurrentOpenId"]); this.HIGW.Value = this.openIdType; HiContext current = HiContext.Current; MemberInfo memberInfo = null; if (!string.IsNullOrEmpty(e.OpenId)) { memberInfo = MemberProcessor.GetMemberByOpenId(this.openIdType, e.OpenId); if (memberInfo == null && this.openIdType.ToLower() == "hishop.plugins.openid.weixin.weixinservice") { memberInfo = MemberProcessor.GetMemberByUnionId(this.openId); this.hidUnionId.Value = this.openId; } } string text = string.Empty; switch (this.openIdType.ToLower()) { case "hishop.plugins.openid.alipay.alipayservice": text = (string.IsNullOrEmpty(this.Parameters["real_name"]) ? string.Empty : this.Parameters["real_name"].Trim()); break; case "hishop.plugins.openid.qq.qqservice": { HttpCookie httpCookie3 = HttpContext.Current.Request.Cookies["NickName"]; if (httpCookie3 != null) { text = HttpUtility.UrlDecode(httpCookie3.Value).Trim(); } break; } case "hishop.plugins.openid.taobao.taobaoservice": { HttpCookie httpCookie4 = HttpContext.Current.Request.Cookies["NickName"]; if (httpCookie4 != null) { text = HttpUtility.UrlDecode(httpCookie4.Value).Trim(); } break; } case "hishop.plugins.openid.sina.sinaservice": { HttpCookie httpCookie2 = HttpContext.Current.Request.Cookies["SinaNickName"]; if (httpCookie2 != null) { text = HttpUtility.UrlDecode(httpCookie2.Value).Trim(); } break; } case "hishop.plugins.openid.weixin.weixinservice": { HttpCookie httpCookie = HttpContext.Current.Request.Cookies["NickName"]; if (httpCookie != null) { text = HttpUtility.UrlDecode(httpCookie.Value).Trim(); } break; } default: this.Page.Response.Redirect("/", true); break; } if (!string.IsNullOrEmpty(text)) { this.btnLogin.Text = text + "," + this.btnLogin.Text; this.labNickName.Text = text; this.hidNickName.Value = text; } if (memberInfo != null) { this.SetLoginState(memberInfo, 0); } }
private void Notify_Authenticated(object sender, AuthenticatedEventArgs e) { this.parameters.Add("CurrentOpenId", e.OpenId); HiContext current = HiContext.Current; MemberInfo memberByOpenId = MemberProcessor.GetMemberByOpenId(this.openIdType, e.OpenId); if (memberByOpenId != null) { Users.SetCurrentUser(memberByOpenId.UserId, 30, true, false); HiContext.Current.User = memberByOpenId; ShoppingCartInfo cookieShoppingCart = ShoppingCartProcessor.GetCookieShoppingCart(); if (cookieShoppingCart != null) { ShoppingCartProcessor.ConvertShoppingCartToDataBase(cookieShoppingCart); ShoppingCartProcessor.ClearCookieShoppingCart(); } if (!string.IsNullOrEmpty(this.parameters["token"])) { HttpCookie httpCookie = new HttpCookie("Token_" + memberByOpenId.UserId); httpCookie.HttpOnly = true; httpCookie.Expires = DateTime.Now.AddMinutes(30.0); httpCookie.Value = this.parameters["token"]; HttpContext.Current.Response.Cookies.Add(httpCookie); } } else { switch (this.openIdType.ToLower()) { case "hishop.plugins.openid.alipay.alipayservice": this.SkipAlipayOpenId(); break; case "hishop.plugins.openid.qq.qqservice": this.SkipQQOpenId(); break; case "hishop.plugins.openid.taobao.taobaoservice": this.SkipTaoBaoOpenId(); break; case "hishop.plugins.openid.sina.sinaservice": this.SkipSinaOpenId(); break; default: this.Page.Response.Redirect("/"); break; } } string a = this.parameters["HITO"]; if (a == "1") { this.Page.Response.Redirect("/SubmmitOrder"); } else { this.Page.Response.Redirect("/"); } }
private void Notify_Authenticated(object sender, AuthenticatedEventArgs e) { HttpCookie cookie; string str2; this.parameters.Add("CurrentOpenId", e.OpenId); HiContext current = HiContext.Current; string usernameWithOpenId = UserHelper.GetUsernameWithOpenId(e.OpenId, this.openIdType); if (string.IsNullOrEmpty(usernameWithOpenId)) { string str3 = this.openIdType.ToLower(); if (str3 == null) { goto Label_024D; } if (!(str3 == "hishop.plugins.openid.alipay.alipayservice")) { if (str3 == "hishop.plugins.openid.qq.qqservice") { this.SkipQQOpenId(); goto Label_0267; } if (str3 == "hishop.plugins.openid.taobao.taobaoservice") { this.SkipTaoBaoOpenId(); goto Label_0267; } if (str3 == "hishop.plugins.openid.sina.sinaservice") { this.SkipSinaOpenId(); goto Label_0267; } goto Label_024D; } this.SkipAlipayOpenId(); goto Label_0267; } Member member = Users.GetUser(0, usernameWithOpenId, false, true) as Member; if (member == null) { base.Response.Write("登录失败,信任登录只能用于会员登录。"); return; } if (HiContext.Current.SiteSettings.IsDistributorSettings) { if (member.ParentUserId.HasValue) { if (member.ParentUserId.Value == HiContext.Current.SiteSettings.UserId) { goto Label_00FE; } } base.Response.Write("账号已经与本平台的其它子站绑定,不能在此域名上登录。"); return; } if (member.ParentUserId.HasValue && (member.ParentUserId.Value != 0)) { base.Response.Write("账号已经与本平台的其它子站绑定,不能在此域名上登录。"); return; } Label_00FE: cookie = FormsAuthentication.GetAuthCookie(member.Username, false); member.GetUserCookie().WriteCookie(cookie, 30, false); HiContext.Current.User = member; ShoppingCartInfo shoppingCart = ShoppingCartProcessor.GetShoppingCart(); CookieShoppingProvider.Instance().ClearShoppingCart(); current.User = member; if (shoppingCart != null) { ShoppingCartProcessor.ConvertShoppingCartToDataBase(shoppingCart); } if (!string.IsNullOrEmpty(this.parameters["token"])) { HttpCookie cookie3 = new HttpCookie("Token_" + HiContext.Current.User.UserId.ToString()); cookie3.Expires = DateTime.Now.AddMinutes(30.0); cookie3.Value = this.parameters["token"]; HttpContext.Current.Response.Cookies.Add(cookie3); } goto Label_0267; Label_024D: this.Page.Response.Redirect(Globals.GetSiteUrls().Home); Label_0267: str2 = this.parameters["HITO"]; if (str2 == "1") { this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("submitOrder")); } else { this.Page.Response.Redirect(Globals.GetSiteUrls().Home); } }
private void OnAuthenticated(object sender, AuthenticatedEventArgs e) { Console.WriteLine("Authenticated"); }
private void Notify_Authenticated(object sender, AuthenticatedEventArgs e) { string str; parameters.Add("CurrentOpenId", e.OpenId); HiContext current = HiContext.Current; string usernameWithOpenId = UserHelper.GetUsernameWithOpenId(e.OpenId, openIdType); if (!string.IsNullOrEmpty(usernameWithOpenId)) { IUser user = Users.GetUser(0, usernameWithOpenId, false, true); if (((user == null) || user.IsAnonymous) || (user.UserRole == UserRole.SiteManager)) { Response.Write("登录失败,信任登录只能用于会员登录。"); return; } if (user.IsLockedOut) { Response.Write("登录失败,您的用户账号还在等待审核。"); return; } HttpCookie authCookie = FormsAuthentication.GetAuthCookie(user.Username, false); user.GetUserCookie().WriteCookie(authCookie, 30, false); HiContext.Current.User = user; ShoppingCartInfo shoppingCart = ShoppingCartProcessor.GetShoppingCart(); CookieShoppingProvider.Instance().ClearShoppingCart(); current.User = user; if (shoppingCart != null) { ShoppingCartProcessor.ConvertShoppingCartToDataBase(shoppingCart); } if (!string.IsNullOrEmpty(parameters["token"])) { HttpCookie cookie3 = new HttpCookie("Token_" + HiContext.Current.User.UserId.ToString()); cookie3.Expires = DateTime.Now.AddMinutes(30.0); cookie3.Value = parameters["token"]; HttpCookie cookie = cookie3; HttpContext.Current.Response.Cookies.Add(cookie); } goto Label_0214; } string str3 = openIdType.ToLower(); if (str3 == null) { goto Label_01F9; } if (!(str3 == "hishop.plugins.openid.alipay.alipayservice")) { if (!(str3 == "hishop.plugins.openid.qq.qqservice")) { goto Label_01F9; } SkipQQOpenId(); } else { SkipAlipayOpenId(); } goto Label_0214; Label_01F9: Page.Response.Redirect(Globals.GetSiteUrls().Home); Label_0214: str = parameters["HITO"]; if (str == "1") { Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("submitOrder")); } else { Page.Response.Redirect(Globals.GetSiteUrls().Home); } }
private void Notify_Authenticated(object sender, AuthenticatedEventArgs e) { this.parameters.Add("CurrentOpenId", e.OpenId); HiContext current = HiContext.Current; string usernameWithOpenId = UserHelper.GetUsernameWithOpenId(e.OpenId, this.openIdType); if (!string.IsNullOrEmpty(usernameWithOpenId)) { Member member = Users.GetUser(0, usernameWithOpenId, false, true) as Member; if (member == null) { base.Response.Write("登录失败,信任登录只能用于会员登录。"); return; } if (member.ParentUserId.HasValue && member.ParentUserId.Value != 0) { base.Response.Write("账号已经与本平台的其它子站绑定,不能在此域名上登录。"); return; } System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(member.Username, false); IUserCookie userCookie = member.GetUserCookie(); userCookie.WriteCookie(authCookie, 30, false); HiContext.Current.User = member; ShoppingCartInfo cookieShoppingCart = ShoppingCartProcessor.GetCookieShoppingCart(); current.User = member; if (cookieShoppingCart != null) { ShoppingCartProcessor.ConvertShoppingCartToDataBase(cookieShoppingCart); ShoppingCartProcessor.ClearCookieShoppingCart(); } if (!string.IsNullOrEmpty(this.parameters["token"])) { System.Web.HttpCookie httpCookie = new System.Web.HttpCookie("Token_" + HiContext.Current.User.UserId.ToString()); httpCookie.Expires = System.DateTime.Now.AddMinutes(30.0); httpCookie.Value = this.parameters["token"]; System.Web.HttpContext.Current.Response.Cookies.Add(httpCookie); } } else { string a; if ((a = this.openIdType.ToLower()) != null) { if (a == "Ecdev.plugins.openid.alipay.alipayservice") { this.SkipAlipayOpenId(); goto IL_1EF; } if (a == "Ecdev.plugins.openid.qq.qqservice") { this.SkipQQOpenId(); goto IL_1EF; } if (a == "Ecdev.plugins.openid.taobao.taobaoservice") { this.SkipTaoBaoOpenId(); goto IL_1EF; } if (a == "Ecdev.plugins.openid.sina.sinaservice") { this.SkipSinaOpenId(); goto IL_1EF; } } this.Page.Response.Redirect(Globals.GetSiteUrls().Home); } IL_1EF: string a2 = this.parameters["HITO"]; if (a2 == "1") { this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("submitOrder")); return; } this.Page.Response.Redirect(Globals.GetSiteUrls().Home); }
private void ImapOnAuthenticated(object sender, AuthenticatedEventArgs authenticatedEventArgs) { OnAuthenticated(authenticatedEventArgs.Message); }
private void Notify_Authenticated(object sender, AuthenticatedEventArgs e) { bool flag = false; if (this.hidToken != null) { this.hidToken.Value = Globals.StripAllTags(this.parameters["token"]); } if (this.hidUserId != null) { this.hidUserId.Value = Globals.StripAllTags(this.parameters["user_id"]); } if (this.hidEmail != null) { this.hidEmail.Value = Globals.StripAllTags(this.parameters["email"]); } string text = ""; switch (this.openIdType.ToLower()) { case "hishop.plugins.openid.alipay.alipayservice": text = (string.IsNullOrEmpty(this.parameters["real_name"]) ? string.Empty : this.parameters["real_name"].ToNullString().Trim()); break; case "hishop.plugins.openid.qq.qqservice": { HttpCookie httpCookie3 = HttpContext.Current.Request.Cookies["NickName"]; if (httpCookie3 != null) { text = HttpUtility.UrlDecode(httpCookie3.Value).Trim(); } break; } case "hishop.plugins.openid.taobao.taobaoservice": { HttpCookie httpCookie4 = HttpContext.Current.Request.Cookies["NickName"]; if (httpCookie4 != null) { text = HttpUtility.UrlDecode(httpCookie4.Value).Trim(); } break; } case "hishop.plugins.openid.sina.sinaservice": { HttpCookie httpCookie2 = HttpContext.Current.Request.Cookies["SinaNickName"]; if (httpCookie2 != null) { text = HttpUtility.UrlDecode(httpCookie2.Value).Trim(); } break; } case "hishop.plugins.openid.weixin.weixinservice": { HttpCookie httpCookie = HttpContext.Current.Request.Cookies["NickName"]; if (text != null) { text = HttpUtility.UrlDecode(httpCookie.Value).Trim(); } break; } default: this.Page.Response.Redirect("/", true); break; } this.hidRealName.Value = text; this.labNickName.Text = text; this.labNickName1.Text = text; this.labNickName2.Text = text; string text2 = this.Page.Request.QueryString["headimage"].ToNullString(); if (string.IsNullOrEmpty(text2)) { text2 = "/Templates/common/images/headerimg.png"; } this.userPicture.Src = text2; this.parameters.Add("CurrentOpenId", e.OpenId); HiContext current = HiContext.Current; this.openId = e.OpenId; if (!string.IsNullOrEmpty(this.openId)) { HttpCookie httpCookie5 = new HttpCookie("openId"); httpCookie5.HttpOnly = true; httpCookie5.Value = this.openId; httpCookie5.Expires = DateTime.MaxValue; HttpContext.Current.Response.Cookies.Add(httpCookie5); } MemberInfo memberByOpenId = MemberProcessor.GetMemberByOpenId(this.openIdType, this.openId); if (memberByOpenId != null) { Users.SetCurrentUser(memberByOpenId.UserId, 1, true, false); ShoppingCartInfo cookieShoppingCart = ShoppingCartProcessor.GetCookieShoppingCart(); current.User = memberByOpenId; if (cookieShoppingCart != null) { ShoppingCartProcessor.ConvertShoppingCartToDataBase(cookieShoppingCart); ShoppingCartProcessor.ClearCookieShoppingCart(); } if (!string.IsNullOrEmpty(this.parameters["token"])) { HttpCookie httpCookie6 = new HttpCookie("Token_" + HiContext.Current.UserId.ToString()); httpCookie6.HttpOnly = true; httpCookie6.Expires = DateTime.Now.AddMinutes(30.0); httpCookie6.Value = Globals.StripAllTags(this.parameters["token"]); HttpContext.Current.Response.Cookies.Add(httpCookie6); } } else { this.AuthMsg = "Auth_Sucess"; } }