Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 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();
        }
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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;
 }
Exemplo n.º 5
0
 public string GetAccountEmail(Account ac)
 {
     Account p = context.Accounts.FirstOrDefault(f => f.Username == ac.Username);
     return p.Email;
 }
Exemplo n.º 6
0
 public ActionResult Index(Account model)
 {
     if (Session["USER"] == null)
        return RedirectToAction("Index", "Login");
     else return View(model);
 }
Exemplo n.º 7
0
 public ActionResult ManageAcc(Account model)
 {
     return View(model);
 }