public IHttpActionResult PostValidadeLogin(LoginRequestModel loginRequest) { LoginBiz loginBiz = new LoginBiz(); LoginResponseModel loginResponse = loginBiz.ValidateLogin(loginRequest); return(Json(loginResponse)); }
private bool VerifySession() { FormsIdentity identity = (FormsIdentity)HttpContext.Current.User.Identity; FormsAuthenticationTicket ticket = identity.Ticket; string[] data = ticket.UserData.Split('|'); Guid sessionId = new Guid(data[2]); return(LoginBiz.VerifySession(ticket.Name, sessionId)); }
private void InsertLoginLog(bool loginResult, string errorDetail) { try { LoginBiz.InsertLoginLog(ConfigurationManager.AppSettings["LoginDomain"].ToString(), Login1.UserName, GetIP4Address(), loginResult, errorDetail); } catch (Exception ex) { _log.Debug(Login1.UserName + ", Method=InsertLoginLog, Error=" + ex.Message); } }
public void SetUp() { #region Initial fake data of constructor //fake service _authService = Substitute.For <IAuthService>(); #endregion _targetObj = new LoginBiz(_authService); }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { try { LoginUserData staffData = StaffBiz.GetLoginUserData(Login1.UserName.Trim()); if (staffData != null) //if (staffData != null && IsAuthenticated(Login1.UserName.Trim(), Login1.Password.Trim())) { Guid sessionId = Guid.NewGuid(); LoginBiz.InsertSession(Login1.UserName.Trim(), sessionId); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 1, Login1.UserName.Trim(), DateTime.Now, DateTime.Now.AddMinutes(FormsAuthentication.Timeout.TotalMinutes), Login1.RememberMeSet, staffData != null ? staffData.StaffNameTH + "|" + staffData.BranchName + "|" + sessionId.ToString() : _displayName + "|" + "", FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ticket); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); //Response.Redirect(FormsAuthentication.GetRedirectUrl(Login1.UserName, Login1.RememberMeSet), false); InsertLoginLog(true, ""); if (Request["ticketid"] != null && Request["accflag"] == "email") { Response.Redirect("COC_SCR_003.aspx?ticketid=" + Request["ticketid"], false); } else { Response.Redirect(FormsAuthentication.DefaultUrl, false); } } else { InsertLoginLog(false, "Logon failure: unknown user name or bad password."); _log.Debug("Logon failure: unknown user name or bad password."); AppUtil.ClientAlert(Page, "Logon failure: unknown user name or bad password."); } } catch (Exception ex) { string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message; InsertLoginLog(false, message); _log.Debug("(" + Login1.UserName + ") " + message); AppUtil.ClientAlert(Page, "Logon failure: unknown user name or bad password."); } }
public void SetUp() { #region Initial fake data of constructor _configContext = new ConfigContext { McpDb = "Data Source=10.37.36.195;Initial Catalog=MCPDev;uid=gary;pwd=Unsoul418!;", UploadPath = "C:/AppOs", ImageEndPoint = "http://localhost:53322/app", IosDownloadAddress = "itms-services://?action=download-manifest&url=" }; //fake service _authService = Substitute.For <IAuthService>(); #endregion _targetObj = new LoginBiz(_authService, _configContext); }
public void Login_Test_False() { var options = new DbContextOptionsBuilder <TestContext>() .UseInMemoryDatabase(databaseName: "Add_writes_to_database") .Options; // Run the test against one instance of the context using (var context = new TestContext(options)) { context.Customers.Add(new Customer() { Name = "sky", PW = "12345" }); context.SaveChanges(); var service = new LoginBiz(context); var result = service.Login("sky", "123"); Assert.False(result); } }
public LoginController(IHttpContextAccessor oHttpContextAccessor) : base(oHttpContextAccessor) { oLoginBiz = new LoginBiz(); _httpcontext = oHttpContextAccessor; }
public LoginModel(LoginBiz loginBiz) { this._loginBiz = loginBiz; }
public LoginForm() { InitializeComponent(); _loginBusiness = new LoginBiz(); }
public LoginController(LoginBiz loginBiz) { _loginBiz = loginBiz; }