private async Task <string> loginProcess() { while (true) { await Task.Run(() => waitingLoginTokenSource.Token.WaitHandle.WaitOne()); UsernameInput.IsReadOnly = true; PasswordInput.Focusable = false; PasswordInput.IsHitTestVisible = false; string login = null; try { login = await ProgressTrackerAPI.LoginAsync(UsernameInput.Text, PasswordInput.Password.ToString()); } catch (TaskCanceledException) { } catch (HttpRequestException) { } if (login != null) { return(login); } else { MessageBox.Show("Login failed. Please try again.", "Login failed", MessageBoxButton.OK, MessageBoxImage.Error); } UsernameInput.Clear(); PasswordInput.Clear(); UsernameInput.IsReadOnly = false; PasswordInput.Focusable = true; PasswordInput.IsHitTestVisible = true; waitingLoginTokenSource = new CancellationTokenSource(); } }
private void Button_Click_Login(object sender, RoutedEventArgs e) { using (var context = new EverydayJournalContext()) { //Getting username and password from the login form var username = UsernameInput.Text; var password = PasswordInput.Password; //Check if the data successfully match in the database if (context.People.Any(a => a.Password == password && a.Name == username)) { var userId = context.People .Where(a => a.Password == password && a.Name == username) .Select(i => new { i.Id, i.Name }) .FirstOrDefault(); MessageBox.Show("Successfully logged!"); //Saving Id and UserName for the current session. LoggerUtility.UserId = userId.Id; LoggerUtility.UserName = userId.Name; //Navigate to UserHomePage UserHomePage userHomePage = new UserHomePage(); this.NavigationService?.Navigate(userHomePage); } else { //Invalid credentials MessageBox.Show("Invalid Username or Password!"); UsernameInput.Clear(); PasswordInput.Clear(); } } }
//private void UsernameInput_KeyUp(object sender, KeyEventArgs e) //{ // if (e.Key == Key.Enter) // { // ParseInput(UsernameInput.Text.Trim(), PasswordInput.Password.Trim()); // } //} private async void ParseInput(string Username, string Password) { if (string.IsNullOrWhiteSpace(Password) || string.IsNullOrWhiteSpace(Username)) { // UsernameInput.Text = "Must enter a username"; PasswordInput.Clear(); } else if (!string.IsNullOrWhiteSpace(Password) && !string.IsNullOrWhiteSpace(Username)) { //login or create account depending on context var outcome = await Task <bool> .Factory.StartNew(() => authenticateLogin(Username, Password)); if (outcome) { ConferenceListWindow main = new ConferenceListWindow(Username, Password, PubKey, loginSpace); App.Current.MainWindow = main; this.Close(); main.Show(); } else { UsernameInput.Clear(); PasswordInput.Clear(); LoginErrorText = "Incorrect user/\npassword"; Keyboard.ClearFocus(); } } }
public void Login(string user, string pasw) { LoginInput.Clear(); PasswordInput.Clear(); LoginInput.SendKeys(user); PasswordInput.SendKeys(pasw); LoginButton.Click(); }
public void LoginToDashboard() { UserInput.Clear(); UserInput.SendKeys("*****@*****.**"); PasswordInput.Clear(); PasswordInput.SendKeys("Password1"); LogIn.Click(); }
private void GoBackButton_Click(object sender, RoutedEventArgs e) { LogonWindow main = new LogonWindow(); App.Current.MainWindow = main; UsernameInput.Clear(); PasswordInput.Clear(); PasswordRepeat.Clear(); this.Close(); main.Show(); }
private void RegisterSubmit_Click(object sender, RoutedEventArgs e) { //Getting the data from the page var name = NameInput.Text; var password = PasswordInput.Password; var email = EmailInput.Text; //Check before using adding to DB if (name.Length < 4) { MessageBox.Show("The name should be greater than 3 symbols!"); } else if (password.Length < 5) { MessageBox.Show("The password should be greater than 4 symbols!"); } else if (!email.Contains("@") || email.Length < 6) { MessageBox.Show("Invalid Email!"); } else { using (var context = new EverydayJournalContext()) { try { context.People .Add(new Person() { Name = name, Password = password, Email = email }); context.SaveChanges(); MessageBox.Show("Registration successful!"); //Saving Id and UserName for the current session. LoggerUtility.UserId = context.People.Where(n => n.Name == name).Select(x => x.Id).FirstOrDefault(); LoggerUtility.UserName = name; UserHomePage homePage = new UserHomePage(); this.NavigationService?.Navigate(homePage); } catch (Exception) { MessageBox.Show("Error with registering. Please, try again!"); NameInput.Clear(); PasswordInput.Clear(); EmailInput.Clear(); } } } }
public void LogIn(string username, string password) { PopupLoginWindow.Click(); UserNameInput.Click(); UserNameInput.Clear(); UserNameInput.SendKeys(username); PasswordInput.Click(); PasswordInput.Clear(); PasswordInput.SendKeys(password); SubmitButton.Click(); }
public RegistrationPage FillForm(string email, string fullName, string password, string cpassword) { EmailInput.Clear(); EmailInput.Set(email); FullNameInput.Clear(); FullNameInput.Set(fullName); PasswordInput.Clear(); PasswordInput.Set(password); ConfirmPasswordInput.Clear(); ConfirmPasswordInput.Set(cpassword); return(this); }
public RegistrationPage FillForm(User user) { EmailInput.Clear(); EmailInput.Set(user.Email.Value); FullNameInput.Clear(); FullNameInput.Set(user.FullName); PasswordInput.Clear(); PasswordInput.Set(user.Password); ConfirmPasswordInput.Clear(); ConfirmPasswordInput.Set(user.Password); return(this); }
private void buttonLogIn_Click(object sender, EventArgs e) { //The password is "123456789", it's saved in the setting of the project if (PasswordInput.Text == Properties.Settings.Default.password) { //when the button is clicked MainForm main = new MainForm(); main.Show(); this.Hide(); } else { MessageBox.Show("ACCESS DENIED!"); PasswordInput.Clear(); } }
private async void ParseInput(string Username, string Password, string Repeat) { if (Password == Repeat) { if (string.IsNullOrWhiteSpace(Password) || string.IsNullOrWhiteSpace(Username)) { // UsernameInput.Text = "Must enter a username"; PasswordInput.Clear(); PasswordRepeat.Clear(); } else if (!string.IsNullOrWhiteSpace(Password) && !string.IsNullOrWhiteSpace(Username)) { //login or create account depending on context var outcome = await Task <bool> .Factory.StartNew(() => AuthenticateAccountCreate(Username, Password)); if (outcome) { LogonWindow main = new LogonWindow(); App.Current.MainWindow = main; UsernameInput.Clear(); PasswordInput.Clear(); PasswordRepeat.Clear(); this.Close(); main.Show(); } else { SignupError.Text = "Username taken"; UsernameInput.Clear(); PasswordInput.Clear(); PasswordRepeat.Clear(); } } } else { SignupError.Text = "Passwords didn't match"; PasswordInput.Clear(); PasswordRepeat.Clear(); } }
private void ClearBoxOnFocus(object sender, RoutedEventArgs e) { if (ResourceInput.IsFocused) { ResourceInput.Clear(); } else { if (string.IsNullOrEmpty(ResourceInput.Text)) { ResourceInput.Text = "Resourse"; } } if (LoginInput.IsFocused) { LoginInput.Clear(); } else { if (string.IsNullOrEmpty(LoginInput.Text)) { LoginInput.Text = "Login name"; } } if (PasswordInput.IsFocused) { PasswordInput.Clear(); } else { if (string.IsNullOrEmpty(PasswordInput.Text)) { PasswordInput.Text = "Password"; } } }
/// <summary> /// Klikniecie w przycisk 'Login' /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { Users users = new Users(); if (users.readUsers(UsernameInput.Text, PasswordInput.Text)) { if (UsernameInput.Text == "Admin") { new Form2("Admin").Show(); } else if (UsernameInput.Text == "Magazynier") { new Form2("Magazynier").Show(); } this.Hide(); } else { MessageBox.Show("Niepoprawne dane logowania"); UsernameInput.Clear(); PasswordInput.Clear(); UsernameInput.Focus(); } }
public void ClearAllLoginForField() { CompanyNameInput.Clear(); LoginInput.Clear(); PasswordInput.Clear(); }
public void enterPassword(string password) { PasswordInput.Clear(); PasswordInput.SendKeys(password); }
private void button_Click(object sender, RoutedEventArgs e) { try { //Connect to Data Base SQLiteDatabase db = new SQLiteDatabase(); //Data Table login that Have All Queries From DB DataTable Login; //Query to Get Username & Password and Compare them In Db if Found! String query = "select * from Login where username='******' and password='******'"; //Put this information from DB to DataTable = login; Login = db.GetDataTable(query); //select grade, username, password string grade = "select grade from Login where username='******' "; string user = "******" + this.UsernameInput.Text + "' "; string pass = "******" + this.PasswordInput.Password + "' "; //Assign (grade, username, password) to local variables (g, u, p) string g = db.ExecuteScalar(grade); string u = db.ExecuteScalar(user); string p = db.ExecuteScalar(pass); //Test if the inputs informations NOT Match to Database Informations ( mdified ) if (this.UsernameInput.Text == u) { if (this.PasswordInput.Password == p) { foreach (DataRow r in Login.Rows) { MessageBox.Show("WELCOME " + g + " " + UsernameInput.Text, "successful", MessageBoxButton.OK, MessageBoxImage.Information); MainWindow admin = new MainWindow(); admin.Show(); this.Close(); } } else { MessageBox.Show("invalid Password "); PasswordInput.Clear(); PasswordInput.Focus(); } } else { MessageBox.Show("F**k you TryCatch Invalid Password or Username"); UsernameInput.Clear(); PasswordInput.Clear(); UsernameInput.Focus(); } } catch (Exception fail) { String error = "The following error has occurred:\n\n"; error += fail.Message.ToString() + "\n\n"; MessageBox.Show(error); this.Close(); } }
public void ClearPassword() { PasswordInput.Clear(); }