private void btnLogin_MouseClick(object sender, MouseEventArgs e) { BusinessLayer.Login log = new BusinessLayer.Login(); Log l = new Log(); DataTable dt = new DataTable(); try { dt = log.getCred(Convert.ToString(txtUsername.Text), Convert.ToString(txtPass.Text)); BusinessLayer.Auth.role = Convert.ToString(dt.Rows[0]["Descr"]); BusinessLayer.Auth.username = Convert.ToString(dt.Rows[0]["Username"]); BusinessLayer.Auth.password = Convert.ToString(dt.Rows[0]["Password"]); l.insertLog(Convert.ToInt32(dt.Rows[0]["UserID"]), Convert.ToDateTime(DateTime.Now), "Login", "Login Page", "Successfull login!"); this.Close(); } //here we can log exceptions when they occur on login catch (Exception ex) { MessageBox.Show("Login not found."); l.insertLog(8, Convert.ToDateTime(DateTime.Now), "Failed Login", "Login Page", "Un-Successfull login! Here's why " + ex); } }
public ActionResult Login(Login login) { if (ModelState.IsValid) { if (WebSecurity.Login(login.Email, login.Password)) { return RedirectToAction("Index", "Home"); } else { ModelState.AddModelError("", "Sorry, The Password or Email is Invalid"); return View(login); } } else { ModelState.AddModelError("", "Sorry, The Password or Email is Invalid"); return View(login); } }
public string GetTitle(Login _login) { return(_data.checkTitle(_login)); }
public bool CheckLogin(Login _log) { return(_data.checklog(_log)); }