public ActionResult ChangePassword(string id) { //Verify the reset password link //Find account associated with this link //redirect to reset password page if (string.IsNullOrWhiteSpace(id)) { return(HttpNotFound()); } using (BunyStoreDbContext dc = new BunyStoreDbContext()) { var user = dc.Users.Where(a => a.ResetPasswordCode == id).FirstOrDefault(); if (user != null) { ResetPasswordModel model = new ResetPasswordModel(); model.ResetCode = id; return(View(model)); } else { return(HttpNotFound()); } } }
public ActionResult ChangePassword(ResetPasswordModel model) { var message = ""; if (ModelState.IsValid) { using (BunyStoreDbContext dc = new BunyStoreDbContext()) { var user = dc.Users.Where(a => a.ResetPasswordCode == model.ResetCode).FirstOrDefault(); if (user != null) { user.Password = Cryptography.CreateMD5(model.NewPassword); user.ResetPasswordCode = ""; dc.Configuration.ValidateOnSaveEnabled = false; dc.SaveChanges(); message = "Mật khẩu đã thay đổi thành công"; } } } else { message = "Mật khẩu và xác nhận mật khẩu phải giống nhau"; } ViewBag.Message = message; return(View(model)); }
public ActionResult SuaThongTin(string emailID) { string message = ""; bool status = false; using (BunyStoreDbContext dc = new BunyStoreDbContext()) { var account = dc.Users.Where(a => a.Email == emailID).FirstOrDefault(); if (account != null) { string resetCode = Guid.NewGuid().ToString(); LinkReset(account.Email, resetCode); account.ResetPasswordCode = resetCode; dc.Configuration.ValidateOnSaveEnabled = false; dc.SaveChanges(); message = "Đường link đổi mật khẩu đã được gửi vào mail của bạn"; } else { message = "Tài khoản không tồn tại"; } } ViewBag.Message = message; return(View()); }
//phan quen mat khau public bool IsEmailExist(string emailID) { using (BunyStoreDbContext dc = new BunyStoreDbContext()) { var v = dc.Users.Where(a => a.Email == emailID).FirstOrDefault(); return(v != null); } }
public ProductDao() { db = new BunyStoreDbContext(); }
public SlideDao() { db = new BunyStoreDbContext(); }
//Tạo constructor public Admindao() { data = new BunyStoreDbContext(); }
public BunyStoreDbContext Init() { return(dbContext ?? (dbContext = new BunyStoreDbContext())); }
public StorerDAO() { data = new BunyStoreDbContext(); }
public ProductCategoryDao() { db = new BunyStoreDbContext(); }
public ProducerDAO() { data = new BunyStoreDbContext(); }
public MenuDao() { db = new BunyStoreDbContext(); }
public ProvinceDAO() { data = new BunyStoreDbContext(); }
public FooterDao() { db = new BunyStoreDbContext(); }
public OrderDao() { db = new BunyStoreDbContext(); }
public ContactDao() { db = new BunyStoreDbContext(); }
//Tạo constructor public DiscountDAO() { data = new BunyStoreDbContext(); }