Exemple #1
0
 private void Check_Remmber()
 {
     foreach (User user in userlist)
     {
         if (user.RememberMe)
         {
             User_login.getIntance().User = user;
             t_1.Interval = 10;
             t_2.Interval = 10;
             t_1.Start();
             if (user.Usertype)
             {
                 t_2.Start(); return;
             }
             return;
         }
     }
 }
        private void update_btn_Click(object sender, EventArgs e)
        {
            confirm_lb.Visible = false;
            string username = txt_1.Text;
            string password = User_login.getIntance().User.Password;
            bool   remmber  = false;
            string cb       = usertype_cb.Text;
            bool   usertype = cb == "Admin" ? true : false;

            listView_user.SelectedItems[0].SubItems[0].Text = username;
            listView_user.SelectedItems[0].SubItems[1].Text = cb;

            User user = new User(username, password, remmber, usertype);

            userlist.Add(user);
            File_Operation.set_csv(userlist, Userpath);
            show_userlist();
        }
Exemple #3
0
        private void login_Click(object sender, EventArgs e)
        {
            string username   = txt_1.Text;
            string password   = Encryption.ComputeSha256Hash(txt_2.Text);
            bool   rememberMe = checkB_1.Checked;

            for (int i = 0; i < userlist.Count; i++)
            {
                User user = userlist[i];

                if (user.IsValid(username, password))
                {
                    user.RememberMe = rememberMe;
                    User_login.getIntance().User = user;
                    File_Operation.set_csv(userlist, Userpath);

                    lb_1.Visible   = true;
                    lb_1.Text      = "Succesfull";
                    lb_1.ForeColor = Color.Green;


                    if (user.Usertype == true)
                    {
                        progressBar1.Visible = true;
                        t_2.Enabled          = true;
                        return;
                    }
                    else
                    {
                        progressBar1.Visible = true;
                        t_1.Enabled          = true;
                        return;
                    }
                }
                else
                {
                    lb_1.Visible = true;
                }
                lb_1.Text      = "Failed";
                lb_1.ForeColor = Color.Red;
            }
        }