Exemple #1
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            this.admins = FileAdapter.GetAllAdmins();
            string loginStr       = login.Text;
            string passStr        = FileAdapter.ComputeSha256Hash(pass.Password);
            bool   isLoginCorrect = false;
            string baseName       = "";

            foreach (Admin admin in admins)
            {
                if (admin.name == loginStr && admin.pass == passStr)
                {
                    isLoginCorrect = true;
                    baseName       = admin.baseName;
                    break;
                }
            }
            if (isLoginCorrect)
            {
                BaseEditor baseEditor = new BaseEditor(baseName);
                baseEditor.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("wpisałeś błędne hasło lub login", "Błąd logowania");
            }
        }
Exemple #2
0
        private void GetHintButton_Click(object sender, RoutedEventArgs e)
        {
            List <Admin> admins         = FileAdapter.GetAllAdmins();
            string       loginStr       = login.Text;
            bool         isLoginCorrect = false;
            string       hint           = "";

            foreach (Admin admin in admins)
            {
                if (admin.name == loginStr)
                {
                    isLoginCorrect = true;
                    hint           = admin.hint;
                    MessageBox.Show("Podpowiedź brzmi: " + hint, "Podpowiedź", MessageBoxButton.OK, MessageBoxImage.Information);
                    break;
                }
            }
            if (!isLoginCorrect)
            {
                MessageBox.Show("Zły login", "Błąd Loginu", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemple #3
0
 public RegisterScreen()
 {
     InitializeComponent();
     this.admins = FileAdapter.GetAllAdmins();
 }