public ActionResult SaveDetail(UserLogin data) { Guid g; g = Guid.NewGuid(); data.SALT = g.ToString(); var temp = FunctionUtility.GetMd5Hash(data.PASSWORD); var newpass = FunctionUtility.GetMd5Hash(data.PASSWORD + data.SALT); data.PASSWORD = newpass; //_memberSrv.UpdateDetail(data); var tempDate = _memberSrv.SaveDetail(data); return(Json(new { returnData = tempDate, jsData = _memberSrv.GetAllDetail() })); }
public bool Login(string user, string pass) { try { var model = entity.UserLogins.Where(p => p.Code == user).FirstOrDefault(); var tempPass = FunctionUtility.GetMd5Hash(pass); var password = FunctionUtility.GetMd5Hash(pass + model.SALT); if (model.PASSWORD == password) { HttpContext.Current.Session["UserRole"] = model.Role; HttpContext.Current.Session["UserName"] = model.FullName; HttpContext.Current.Session["UserCode"] = model.Code; return(true); } else { return(false); } } catch (Exception) { return(false); } }