Exemple #1
0
        private void btn_registreren_Click(object sender, EventArgs e)
        {
            SomerenLogic.Account_Service accountToevoegen = new SomerenLogic.Account_Service();
            Account     nieuwAccount     = new Account();
            HashAndSalt hashPassword     = new HashAndSalt();
            string      salt             = hashPassword.CreateSalt(64);
            string      hashedWachtwoord = hashPassword.GenerateHash(txtbox_nieuwePassword.Text, salt);

            nieuwAccount.Gebruikersnaam = txtbox_nieuweUser.Text;
            nieuwAccount.Wachtwoord     = hashedWachtwoord;
            nieuwAccount.AdminStatus    = "user";
            nieuwAccount.Vraag          = txtBox_geheimeVraag.Text;
            nieuwAccount.Antwoord       = txtBox_geheimAntwoord.Text;
            nieuwAccount.Salt           = salt;

            if (txtbox_licentieSleutel.Text == "XsZAb-tgz3PsD-qYh69un-WQCEx")
            {
                accountToevoegen.AccountToevoegen(nieuwAccount);
                this.Hide();
                LoginScreen loginScreen = new LoginScreen();
                loginScreen.Show();
            }
            else
            {
                MessageBox.Show("Foute licentieSleutel..");
            }
        }
Exemple #2
0
        private async void btn_PasswordWasChanged_Clicked(Object sender, EventArgs e)
        {
            showMyData();
            string SaltedPassword = HashAndSalt.CreateSalt().Trim(' ');
            string uName          = userName.Text;
            string email          = myEmail.Text;
            string password       = HashAndSalt.HashString(String.Format("{0}{1}", myPassword.Text, SaltedPassword));
            string password2      = HashAndSalt.HashString(String.Format("{0}{1}", myPassword2.Text, SaltedPassword));

            if (Database.changePassword(password, SaltedPassword, SpecificUser.UserID))
            {
                await DisplayAlert("Super", "Dein Passwort wurde erfolgreich geändert", "Ok");

                App.Current.MainPage = new NavigationPage(new MainPage());
            }
            else
            {
                await DisplayAlert("Fehlgeschlagen", "Dein Passwort wurde nicht geändert :(", "Mist");
            }
            //passwort in Datenbank ändern
        }
        private void btn_enter3_Click(object sender, EventArgs e)
        {
            SomerenLogic.Account_Service AccountNewPassword = new SomerenLogic.Account_Service();
            Account acc = new Account();

            HashAndSalt hashPassword     = new HashAndSalt();
            string      salt             = hashPassword.CreateSalt(64);
            string      hashedWachtwoord = hashPassword.GenerateHash(tb_NewPassword.Text, salt);

            AccountNewPassword.AlterPassword(tb_NewPassword.Text, hashedWachtwoord, salt);

            string gebruikersnaam = tb_GebruiksN.Text;
            string wachtwoord     = tb_NewPassword.Text;

            AccountNewPassword.AlterPassword(gebruikersnaam, hashedWachtwoord, salt);

            MessageBox.Show("Wachtwoord is veranderd");
            LoginScreen login = new LoginScreen();

            login.Show();
            this.Close();
        }