protected void LoginButton(object sender, EventArgs e) { if (Page.IsValid) { string hashedPswd = HashPassword.ApplyHash(txtModalCustPassword.Text); //string custEmail = String.Format("{0}", Request.Form["email_modal"]); //string custPassword = String.Format("{0}", Request.Form["password_modal"]); Customers custLogin = new Customers(txtModalCustEmail.Text, hashedPswd); string output = CustomersDB.GetCustomerLogin(custLogin); if (output == "1") { Session["custEmail"] = txtModalCustEmail.Text; Customers loggedCustomer = CustomersDB.GetCustomerbyEmail(Session["custEmail"].ToString()); Session["customerId"] = (int)loggedCustomer.CustomerId; Response.Redirect("CustomerRegistration.aspx"); } else { Control loginFail = FindControl("LoginFailure"); loginFail.Visible = true; string script = @"document.getElementById('" + LoginFailure.ClientID + "').innerHTML='Login failed, please check your credentials.' ;setTimeout(function(){document.getElementById('" + LoginFailure.ClientID + "').style.display='none';},5000);"; Page.ClientScript.RegisterStartupScript(this.GetType(), "somekey", script, true); } } }
protected void LoginButton(object sender, EventArgs e) { if (Page.IsValid) { string hashedPswd = HashPassword.ApplyHash(txtModalCustPassword.Text); // string custEmail = String.Format("{0}", Request.Form["email_modal"]); // string custPassword = String.Format("{0}", Request.Form["password_modal"]); Customers custLogin = new Customers(txtModalCustEmail.Text, hashedPswd); string output = CustomersDB.GetCustomerLogin(custLogin); if (output == "1") { Session["custEmail"] = txtModalCustEmail.Text; Customers loggedCustomer = CustomersDB.GetCustomerbyEmail(Session["custEmail"].ToString()); Session["customerId"] = (int)loggedCustomer.CustomerId; Response.Redirect("ItemsBought.aspx"); } else { Response.Write("Login Failed"); } } }