private void validate()
        {
            User us = new User();

            if (txtName.Text != "" && txtPassword.Password != "")
            {
                us.Usernane = txtName.Text;

                us.Password = txtPassword.Password;
            }
            try
            {
                u = SQLDB.GetUser(us);
                if (u != null && u.Password == "1234")
                {
                    DialogPassword dialog = new DialogPassword();
                    if (dialog.ShowDialog() == true)
                    {
                        u.Password = dialog.Password;
                        SQLDB.UpdateUserPassword(u.Usernane, u.Password);
                    }
                }
            }
            catch (Exception ex)
            {
                FileHandler.Error(ex);
            }

            if (u != null)
            {
                DialogResult = true;
            }
            else
            {
                txtPassword.Password = "";
                txtWrong.Text        = "Forkert login";
                txtName.SelectAll();
                txtName.Focus();
            }
        }
Exemple #2
0
        private string checkCeredentials()
        {
            string lMasterPass = null;

            try
            {
                bool dataExist = readWriteClass.checkDataExists();

                if (!dataExist || (mPass == null || mPass == ""))
                {
                    DialogPassword passWindow   = new DialogPassword();
                    bool?          resultDialog = passWindow.ShowDialog();

                    if (resultDialog != null && resultDialog.ToString().ToUpper() == "TRUE")
                    {
                        lMasterPass = passWindow.mPass;

                        if (readWriteClass.passwordCheck(lMasterPass))
                        {
                            return(lMasterPass);
                        }
                    }
                }
                else
                {
                    lMasterPass = mPass;
                }
            }
            catch (Exception ex)
            {
                callLogger("Método checkCredentials() de la clase Controller => " + ex.ToString() + "__" + DateTime.Now);
                lMasterPass = null;
            }

            return(lMasterPass);
        }
Exemple #3
0
        private void Btn_new_pas_Click(object sender, RoutedEventArgs e)
        {
            DialogPassword dlg = new DialogPassword(true, Users);

            dlg.ShowDialog();
        }
        private void Btn_new_pas_Click(object sender, RoutedEventArgs e)
        {
            DialogPassword dlg = new DialogPassword(false, (sender as Button).DataContext as Users);

            dlg.ShowDialog();
        }