示例#1
0
        public void checkEqual()
        {
            DoiMatKhau dmk = new DoiMatKhau();
            var        r   = dmk.checkEqual("phamduy12", "phamduy12");

            Assert.IsFalse(r);
        }
示例#2
0
        public void checkCorrect()
        {
            DoiMatKhau dmk = new DoiMatKhau();
            var        r   = dmk.checkCorrect("phamduy123", "phamduy123");

            Assert.IsFalse(r);
        }
示例#3
0
        public void checkPass()
        {
            DoiMatKhau dmk = new DoiMatKhau();
            var        r   = dmk.checkPassNew("phamduy123");

            Assert.IsTrue(r);
        }
示例#4
0
        public void DoiMatKhau()
        {
tt:
            if (doimatkhau == null || doimatkhau.IsDisposed)
            {
                doimatkhau = new DoiMatKhau();
            }
            if (doimatkhau.ShowDialog() == DialogResult.OK)
            {
                String tenDangNhap    = dangnhap.txtTenDangNhap.Text;
                String matKhau        = dangnhap.txtMatKhau.Text;
                String matKhauCu      = doimatkhau.txtMatKhauCu.Text;
                String matKhauMoi     = doimatkhau.txtMatKhauMoi.Text;
                String xacNhanMatKhau = doimatkhau.txtXacNhanMatKhau.Text;
                if (matKhau != matKhauCu)
                {
                    MessageBox.Show("Mật khẩu hiện tại không phù hợp!");
                    goto tt;
                }

                else if (matKhauMoi != xacNhanMatKhau)
                {
                    MessageBox.Show(" Sai mật khẩu xác nhận");
                    goto tt;
                }
                else
                {
                    NguoiDungControl ctrlND = new NguoiDungControl();
                    ctrlND.UpdatePassword(tenDangNhap, matKhauMoi);
                    //DoiMatKhau(tenDangNhap,matKhauMoi);
                    MessageBox.Show("Đổi mật khẩu thành công!");
                }
            }
        }
        private void barButtonItem4_ItemClick(object sender, ItemClickEventArgs e)
        {
            DoiMatKhau f = new DoiMatKhau(Sess);

            this.Hide();
            f.ShowDialog();
            this.Show();
        }
示例#6
0
        private void btnChangePass_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DoiMatKhau dmk = new DoiMatKhau();

            dmk.id = Convert.ToInt32(txtIdNhanvien.EditValue);
            dmk.t  = 0;
            dmk.ShowDialog();
        }
        private void btnDoiMatKhau_Click(object sender, EventArgs e)
        {
            panelTrangChu.Visible = false;
            panel.Visible         = true;
            this.panel.Controls.Clear();
            DoiMatKhau frm = new DoiMatKhau(tbTenTK.Text);

            frm.TopLevel        = false;
            frm.FormBorderStyle = FormBorderStyle.None;
            frm.AutoScroll      = true;
            this.panel.Controls.Add(frm);
            frm.Show();
        }
        private void buttonDoiMatKhau_Click(object sender, EventArgs e)
        {
TiepTuc:
            if (doimatkhau == null || doimatkhau.IsDisposed)
            {
                doimatkhau = new Frm_DoiMatKhau();
            }
            if (doimatkhau.ShowDialog() == DialogResult.OK)
            {
                String     mkcu    = doimatkhau.matkhaucu;
                String     mkmoi   = doimatkhau.matkhaumoi;
                string     xnmkmoi = doimatkhau.xacnhanmatkhaumoi;
                DoiMatKhau dmk     = new DoiMatKhau();
                int        KetQua  = dmk.kiemtra(mkcu, mkmoi, xnmkmoi, lbl_tennguoidung.Text);
                switch (KetQua)
                {
                case 0:
                    MessageBox.Show("Không được để trống bất kỳ trường nào!");
                    goto TiepTuc;

                case 1:
                    MessageBox.Show("Mật khẩu cũ không khớp!");
                    goto TiepTuc;

                case 2:
                    MessageBox.Show("Mật khẩu mới & Xác nhận mật khẩu mới: Không khớp với nhau!");
                    goto TiepTuc;

                case 3:
                    if (dmk.Capnhatmatkhau(mkmoi, lbl_tennguoidung.Text))
                    {
                        if (MessageBox.Show("Cập nhật mật khẩu thành công!. Khởi động lại ứng dụng?", "Thông báo", MessageBoxButtons.OK) == System.Windows.Forms.DialogResult.OK)
                        {
                            Application.Restart();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Đổi mật khẩu không thành công!");
                        goto TiepTuc;
                    }

                    break;
                }
            }
        }
 private void mnuHeThongDoiMatKhau_Click(object sender, RoutedEventArgs e)
 {
     if (Common.maNhanVien != null)
     {
         DoiMatKhau f = new DoiMatKhau();
         f.ShowDialog();
     }
     else
     {
         MessageBox.Show("Bạn phải đăng nhập để sử dụng chức năng này");
         this.Close();
         MainWindow main = new MainWindow();
         main.Show();
         DangNhap dn = new DangNhap();
         dn.ShowDialog();
     }
 }
示例#10
0
        private void FrMain_Load(object sender, EventArgs e)
        {
            chart = new DanhGiaNangLuc();
            ////THHT = new TinhHinhHocTap();

            QLMH   = new QuanLyMonHoc();
            DiemSV = new DiemSinhVien();
            QLK    = new QuanLyKhoa();
            QLLH   = new QuanLyLopHoc();
            TTSV   = new ThongTinSinhVien();
            DMK    = new DoiMatKhau(account);
            TTTK   = new ThongTinTaiKhoan(account, DMK);
            inf    = new information();
            QLND   = new QuanLyNguoiDung();
            SLSVTK = new SoLuongSinhVienTheoKhoa();
            this.pnlDisplay.Controls.Add(SLSVTK);


            this.pnlDisplay.Controls.Add(QLND);

            this.pnlDisplay.Controls.Add(QLMH);
            this.pnlDisplay.Controls.Add(DiemSV);
            this.pnlDisplay.Controls.Add(QLK);
            this.pnlDisplay.Controls.Add(QLLH);
            this.pnlDisplay.Controls.Add(TTSV);
            this.pnlDisplay.Controls.Add(TTTK);
            this.pnlDisplay.Controls.Add(inf);
            this.pnlDisplay.Controls.Add(DMK);
            this.pnlDisplay.Controls.Add(chart);

            this.SLSVTK.Visible = false;
            this.chart.Visible  = false;
            this.QLND.Visible   = false;
            this.DiemSV.Visible = false;

            this.QLMH.Visible = false;
            this.QLK.Visible  = false;
            this.QLLH.Visible = false;
            this.TTSV.Visible = false;
            this.DMK.Visible  = false;
            this.TTTK.Visible = false;
            this.inf.Visible  = false;
        }
示例#11
0
        public IHttpActionResult doiMatKhau([FromBody] DoiMatKhau doMK)
        {
            try
            {
                KhachHang kh = db.KhachHangs.FirstOrDefault(e => e.id_khach_hang == doMK.idKhachHang &&
                                                            e.mat_khau.Equals(doMK.matKhauCu) &&
                                                            e.trang_thai == true);
                if (kh == null)
                {
                    return(StatusCode(HttpStatusCode.NoContent));
                }

                kh.mat_khau = doMK.matKhauMoi;
                db.SubmitChanges();
                return(Ok());
            }catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public ActionResult DoiMatKhau(DoiMatKhau model)
        {
            string    mk  = Request.Form["MKC"];
            string    MKC = MaHoa.MD5(mk);
            NGUOIDUNG kh  = (NGUOIDUNG)Session["KhachHang"];

            if (ModelState.IsValid)
            {
                if (kh.MATKHAU != MKC)
                {
                    ModelState.AddModelError("", "Mật khẫu cũ bạn nhập chưa đúng, hãy kiểm tra lại");
                    return(View());
                }
                kh.MATKHAU         = MaHoa.MD5(model.MatKhauMoi);
                db.Entry(kh).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "TinTuc"));
            }
            return(View(kh));
        }
示例#13
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var window = new DoiMatKhau(ID);

            window.ShowDialog();
        }
示例#14
0
        private void barbtndoimatkhau_ItemClick(object sender, ItemClickEventArgs e)
        {
            DoiMatKhau DoiMatKhau = new DoiMatKhau(taikhoandn);

            DoiMatKhau.ShowDialog();
        }
示例#15
0
        private void btn_DoiMatKhau_Click(object sender, EventArgs e)
        {
            DoiMatKhau doiMatKhau = new DoiMatKhau(Config.CURRENT_NHANVIEN);

            doiMatKhau.ShowDialog();
        }