private void GuiLaiMatKhau() { string Username = (string)Request["Username"]; byte[] arr = new byte[10]; Random r = new Random((int)DateTime.Now.ToBinary()); r.NextBytes(arr); string pass = Utilities.ConvertToHexa(arr); NguoiDungBUS ndBus = new NguoiDungBUS(); NguoiDungDTO dto = ndBus.LayThongTinNguoiDung(Username); int maNguoiDung = dto.Ma_nguoi_dung; bool flag = Utilities.SendMail("*****@*****.**", dto.Email, "(OFFS) Reset mật khẩu", "Mật khẩu mới: <strong>" + pass + "</strong>") == ""; string passSHA1 = Utilities.SHA1(pass).ToLower(); bool kq = ndBus.CapNhatThongTinMatKhau(passSHA1, maNguoiDung); XL_THE the = new XL_THE("goc"); XL_THUOC_TINH thuoctinh = new XL_THUOC_TINH("kq", flag && kq ? "1" : "0"); the.Danh_sach_thuoc_tinh.Add(thuoctinh); string chuoi = the.Chuoi(); XL_CHUOI.XuatChuoi(Response, chuoi); }
private void CapNhatThongTinMatKhau() { viewKhachHangDTO vkhDto = (viewKhachHangDTO)Session["khachhang"]; //Lấy tham số client truyền xuống string mkcu = XL_CHUOI.Nhap(Request, "mkcu"); string mkmoi = XL_CHUOI.Nhap(Request, "mkmoi"); XL_THE the = new XL_THE("goc"); if (mkcu != vkhDto.Password) { the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("kq", "False")); XL_CHUOI.XuatChuoi(Response, the.Chuoi()); return; } //Cập nhật int Ma_nguoi_dung = vkhDto.Ma_nguoi_dung; NguoiDungBUS ndBus = new NguoiDungBUS(); bool kq = ndBus.CapNhatThongTinMatKhau(mkmoi, Ma_nguoi_dung); if (kq == true) { vkhDto.Password = mkmoi; Session["khachhang"] = vkhDto; //Lưu thông tin cho biến trong session the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("kq", "True")); } else { the.Danh_sach_thuoc_tinh.Add(new XL_THUOC_TINH("kq", "False")); } XL_CHUOI.XuatChuoi(Response, the.Chuoi()); }