예제 #1
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            string new_password = RandomString(7);

            if (txtID.Text != "")
            {
                string encrypt_password = KG.EncryptString(new_password);

                DialogResult dr = MessageBox.Show("Are You Sure to Reset Password this User?", "QUESTION", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    UC.Reset_Password_User(encrypt_password, Convert.ToInt32(txtID.Text));
                    MessageBox.Show("The New Password: "******"INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                EnableButton(true);
                clearField();
                btnClose.Text = "Close";
                VisibleButton(false);
                setDatagridview(dgUser);
            }
            else
            {
                MessageBox.Show("Please, Choose the Users to Reset Password...!", "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
예제 #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string role_id = UC.Get_RoleID_User(temp_user_id);

            if (txtConfirm.Text == txtNew.Text)
            {
                string encrypt_password = KG.EncryptString(txtNew.Text);

                DialogResult dr = MessageBox.Show("Are You Sure to Change Your Password?", "QUESTION", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    UC.Reset_Password_User(encrypt_password, temp_user_id);
                    MessageBox.Show("Your Password Has Been Changed", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (role_id != "STD")
                    {
                        this.Hide();
                    }
                    else
                    {
                        FormQuis FQ = new FormQuis(temp_user_id);
                        FQ.ShowDialog();
                        this.Close();
                    }
                }
            }
            else
            {
                MessageBox.Show("Password Confirm is Wrong...", "INFORMATION", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #3
0
        public bool Check_Login(string username, string pass)
        {
            //string temp_password = TU.Get_Password(username).ToString();
            string decrypt_password = KG.EncryptString(pass);

            pass = decrypt_password;

            bool check = false;

            try
            {
                if (TU.GetUser(username, pass).ToString() != "")
                {
                    check = true;
                }
            }
            catch
            {
                check = false;
            }
            return(check);
        }