Пример #1
0
 private void FormListarUsuarios_Load(object sender, EventArgs e)
 {
     ClassLogin lg = new ClassLogin();
     {
         this.dataGridView1.DataSource = lg.ListarLogin();
         this.dataGridView1.Refresh();
     }
 }
Пример #2
0
 public LogIn(ClassLogin inCL, ClassBiz inCB, Grid inGrid)
 {
     InitializeComponent();
     CL                    = inCL;
     CB                    = inCB;
     LoginGrid             = inGrid;
     LoginGrid.DataContext = CB;
 }
Пример #3
0
 public UserControlLogin(ClassLogin inCL, ClassBIZ inBIZ, Grid tGrid)
 {
     InitializeComponent();
     CL = inCL;
     CB = inBIZ;
     GridLogin.DataContext = CL;
     inGrid = tGrid;
 }
        private void iconbtnAccept_Click(object sender, EventArgs e)
        {
            ClassLogin classLogin = new ClassLogin();

            classLogin.Usuario    = txtUsers.Text;
            classLogin.contrasena = txtAccess.Text;
            this.Close();
            _dataAccess.login(classLogin);
        }
Пример #5
0
 public LogIn(ClassLogin inCL, ClassBiz inCB, Window inWN)
 {
     InitializeComponent();
     CL            = inCL;
     CB            = inCB;
     callingWindow = inWN;
     this.textBoxCprNr.DataContext    = CL;
     this.textBoxPassword.DataContext = CL;
 }
Пример #6
0
        public MainWindow()
        {
            InitializeComponent();
            CB  = new ClassBIZ();
            CL  = new ClassLogin();
            UCL = new UserControlLogin(CL, CB, MainFormGrid);
            UCM = new UserControlMain(CB);

            MainFormGrid.Children.Add(UCM);
            MainFormGrid.Children.Add(UCL);
        }
Пример #7
0
        public IActionResult LoginMethod([FromBody] ClassLogin user)
        {
            var login = db.Student.Where(p => p.Login == user.Login && p.Password == user.Password);

            if (login.Count() != 0)
            {
                HttpContext.Session.SetString("Login", user.Login);

                return(Ok(HttpContext.Session.GetString("Login")));
            }
            else
            {
                return(Ok("Invalid Email or Password"));
            }
        }
Пример #8
0
        public void TestMethod1()
        {
            //-----------------------Testing Login with username and password, admin.----------------------------

            ClassLogin GoCL = new ClassLogin();

            GoCL.Classusername = "******";
            GoCL.Classpassword = "******";

            Boolean Needed = true;

            Boolean Checking = GoCL.checkUser().Item1;

            Assert.AreEqual(Checking, Needed);
        }
Пример #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            //SqlConnection con = new SqlConnection(@"Data Source=DESKTOP-2CL7BNE;Initial Catalog=DataTravel;Integrated Security=True");
            //SqlDataAdapter sda = new SqlDataAdapter("SELECT COUNT(*) FROM admin WHERE username='******' and password='******'", con);

            ClassLogin d = new ClassLogin();

            if (this.tbpass.Text == d.Password && this.tbuname.Text == d.UserName)
            {
                home hm = new home();
                hm.Tag = this;
                hm.Show(this);
                Hide();
            }
            else
            {
                MessageBox.Show("Username atau Password salah");
            }

            //if (dt.Rows[0][0].ToString() == "1")
            //{
            //    home hm = new home();
            //    hm.Tag = this;
            //    hm.Show(this);
            //    Hide();
            //}
            //else
            //    MessageBox.Show("Invalid username or password");

            //int count = 0;

            //if (count == 1)
            //{
            //    home hm = new home();
            //    hm.Tag = this;
            //    hm.Show(this);
            //    Hide();
            //}
            //else if (count > 0)
            //{
            //    MessageBox.Show("duplicate username and password");
            //}
            //else
            //{
            //    MessageBox.Show( "username and password note correct");
            //}
        }
Пример #10
0
        public ActionResult masuk(ClassLogin login) // yang ijomuda itu nama class
        {
            var currentAccount = Mycontext.Login.FirstOrDefault(dta => dta.Email == login.Email);

            if (currentAccount != null)
            {
                var password = BCrypt.Net.BCrypt.Verify(login.Password, currentAccount.Password);
                if (password == true)
                {
                    Session["id"] = login.id;
                    Session.Add("email", login.Email);
                    //retun view ("WELCOME")
                    return(RedirectToAction("dashboard", "Login"));
                }
            }
            ViewBag.error = "Invalid";
            return(View("Index"));
        }
Пример #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            ClassLogin lg = new ClassLogin();
            string     mensaje;

            string user = this.textBoxUser.Text;
            string pass = this.textBoxPassword.Text;

            mensaje = lg.Loguearse(user, pass);

            if (mensaje.ToString() == "Administrador")
            {
                MessageBox.Show("Bienvenido Administrador");

                FormMenu menu = new FormMenu();
                menu.FormClosed += new FormClosedEventHandler(form2_FormClosed);
                menu.ShowDialog();

                textBoxUser.Text     = "";
                textBoxPassword.Text = "";
            }
            else if (mensaje.ToString() == "Contador")
            {
                MessageBox.Show("Bienvenido Contador");

                FormMenu menu = new FormMenu();
                menu.FormClosed += new FormClosedEventHandler(form2_FormClosed);
                menu.ShowDialog();

                textBoxUser.Text     = "";
                textBoxPassword.Text = "";
            }
            else
            {
                MessageBox.Show(mensaje);
                textBoxUser.Text     = "";
                textBoxPassword.Text = "";
                textBoxUser.Focus();
            }
        }
Пример #12
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ClassLogin Logica = new ClassLogin();

            string resp;

            resp = Logica.Ingresar(TextBoxUsuario.Text, TextBoxClave.Password, Convert.ToInt32(comboBoxUsuario.SelectedValue));
            Logica.verificar();
            var ver = Logica.verificar();

            if (resp.ToUpper().Contains("ERROR"))
            {
                MessageBox.Show(resp, "Error al ingresar");
            }
            else
            {
                if (resp == "Bienvenido1")
                {
                    MessageBox.Show("Bienvenido digitador");
                    Menu nuevo = new Menu(); //crea el nuevo formulario
                    nuevo.Show();            //enseña el nuevo formulario
                    this.Close();            //cierra el formulario actualmente abierto*
                }
                else if (resp == "Bienvenido2")
                {
                    MessageBox.Show("Binevenido Administrador");
                }
                else if (resp == "Bienvenido3")
                {
                    MessageBox.Show("Binevenido Empleado");
                }
                else
                {
                    MessageBox.Show("Datos incorrectos");
                }
                TextBoxUsuario.Clear();
                TextBoxClave.Clear();
            }
        }
Пример #13
0
        public async Task <ActionResult> Create(ClassLogin login)
        {
            login.Password = BCrypt.Net.BCrypt.HashPassword(login.Password);
            Mycontext.Login.Add(login);
            Mycontext.SaveChanges();
            MailMessage sub = new MailMessage("*****@*****.**", login.Email);

            sub.Subject = "[Password]" + DateTime.Now.ToString("ddMMyyyyhhmmss");
            sub.Body    = "Welcome!" + login.Email + "\nYour New Password: "******"smtp.gmail.com";
            smtp.Port      = 587;
            smtp.EnableSsl = true;

            NetworkCredential nc = new NetworkCredential("*****@*****.**", "bucinnyaJK");

            smtp.UseDefaultCredentials = false;
            smtp.Credentials           = nc;
            smtp.Send(sub);
            ViewBag.Message = "Password Has Been Sent. Please check your email";
            return(RedirectToAction("Index", "login"));
        }