public ActionResult ResetPass(Account model,string NewPassword) { Cryptography ch = new Cryptography(); Account acc = dal.FindAcc(model); dal.ChangePass(acc, ch.md5(NewPassword)); return RedirectToAction("Index","Login",acc); }
public void ChangePass(Account ac, string NewPass) { Account original = context.Accounts.Find(ac.Username); if (original != null) { context.Entry(original).Property(u => u.Password).CurrentValue = NewPass; //context.Entry(original).CurrentValues.SetValues(ac.Password = NewPass); context.SaveChanges(); } }
public Account FindAcc(Account ac) { Account p = context.Accounts.FirstOrDefault(f => f.Username == ac.Username); // Debug.WriteLine(ac.Password); ac.Password = e.md5(ac.Password); // Debug.WriteLine(ac.Password); // Debug.WriteLine(p.Password); if(p!=null) if (ac.Password.Equals(p.Password)) return p; return null; }
public Boolean AddAccount(Account ac) { Account temp = context.Accounts.FirstOrDefault(f => f.Username== ac.Username); if (temp == null) { ac.Password = e.md5(ac.Password); context.Accounts.Add(ac); context.SaveChanges(); return true; } else return false; }
public string GetAccountEmail(Account ac) { Account p = context.Accounts.FirstOrDefault(f => f.Username == ac.Username); return p.Email; }
public ActionResult Index(Account model) { if (Session["USER"] == null) return RedirectToAction("Index", "Login"); else return View(model); }
public ActionResult ManageAcc(Account model) { return View(model); }