public LoginWindow(MainWindow mainWRef, Logic logicRef) { this.mainWRef = mainWRef; this.logicRef = logicRef; InitializeComponent(); UsernameTB.Focus(); }
private void Login_B_Click(object sender, RoutedEventArgs e) { logicObj = new Logic(); if (logicObj.checkLogin(UsernameTB.Text, PasswordTB.Password)) { //viewmodel.ActivateButton = true; this.Close(); } else { MessageBox.Show("Brugernavn og password stemmer ikke overens.\nPrøv igen."); PasswordTB.Clear(); UsernameTB.Focus(); UsernameTB.SelectAll(); } }
private void loginButton_Click(object sender, RoutedEventArgs e) { if (logicRef.checkLogin(UsernameTB.Text, PasswordTB.Password)) { mainWRef.LoginOk = true; mainWRef.SocSecNb = UsernameTB.Text; this.Close(); } else { MessageBox.Show("Brugernavn og password stemmer ikke overens.\nPrøv igen."); PasswordTB.Clear(); UsernameTB.Focus(); UsernameTB.SelectAll(); } }
void Guest_Click(object sender, EventArgs e) { DB.Connection = new MySqlConnection(new MySqlConnectionStringBuilder { Server = "91.221.70.206", UserID = "mycursa4_Guest", Password = "******", ConvertZeroDateTime = true, SslMode = MySqlSslMode.None }.ToString()); Program.IsGuest = true; LeaveForm(); Hide(); new Rating().ShowDialog(); Show(); UsernameTB.Focus(); }
private bool ChangeUsernamePasswordValidation() { int length = UsernameTB.Text.Length; if (length < 5) { MessageBox.Show("Username should be at least 6 character long.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } length = 0; length = PasswordTB.Text.Length; if (length < 7) { MessageBox.Show("New Password should be at least 8 character long.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } if (userName == string.Empty || userName != UsernameTB.Text) { if (userAccount.CheckForUserName(UsernameTB.Text)) { MessageBox.Show("Username : '******' already exists. Please enter unique Username.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); UsernameTB.Focus(); return(false); } } if (!userAccount.CheckOldPassword(OldPasswordTextbox)) { OldPasswordTextbox.Focus(); return(false); } //check new password and renew password if (!(ReEnterPassword.Text == PasswordTB.Text)) { MessageBox.Show("Repassword didn't matched.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return(false); } return(true); }
void Login_Click(object sender, EventArgs e) { UsernameTB.Text = UsernameTB.Text.Trim(); PasswordTB.Text = PasswordTB.Text.Trim(); if (UsernameTB.Text.Length < 1 || PasswordTB.Text.Length < 1) { return; } for (int i = 0; i < Program.Users.GetLength(0); i++) { if (UsernameTB.Text == Program.Users[i, 0] && PasswordTB.Text == Program.Users[i, 1]) { DB.Connection = new MySqlConnection(new MySqlConnectionStringBuilder { Server = "91.221.70.206", UserID = UsernameTB.Text, Password = PasswordTB.Text, ConvertZeroDateTime = true, SslMode = MySqlSslMode.None }.ToString()); Program.IsGuest = false; LeaveForm(); Hide(); new Main().ShowDialog(); Show(); UsernameTB.Focus(); return; } } UsernameTB.BackColor = Color.Red; PasswordTB.BackColor = Color.Red; UsernameTB.ForeColor = Color.WhiteSmoke; PasswordTB.ForeColor = Color.WhiteSmoke; }
private void RegisterBTN_Click(object sender, EventArgs e) { fname = FirstNameTB.Text; lname = LastNameTB.Text; address = AddressTB.Text; tel = TelTB.Text; username = UsernameTB.Text; password = PassWordTB.Text; conn.Open(); if (fname != "" && lname != "" && address != "" && tel != "" && username != "" && password != "") { if (check == 1) { //cmd.CommandText = "INSERT INTO User (UserName,Name,Surname,Address,Telephone,Password,UserTypeID) VALUES ('"+ username +"','"+ //fname +"','"+ lname +"','"+address +"','"+ tel +"','" + password + "'," + 1 + ")"; cmd.CommandText = "INSERT INTO [User] ( UserName, Name, Surname, Address, Telephone, [Password], UserTypeID ) " + "SELECT '" + username + "' AS Expr1, '" + fname + "' AS Expr2, '" + lname + "' AS Expr3, '" + address + "' AS Expr4, '" + tel + "' AS Expr5, '" + password + "' AS Expr6, " + 1 + " AS Expr7"; cmd.ExecuteNonQuery(); MessageBox.Show("Success"); this.Close(); LogIn login = new LogIn(); login.Show(); } else { MessageBox.Show("This username is already used"); UsernameTB.Focus(); } } else { MessageBox.Show("Please fill an empty textbox"); } //cmd.ExecuteNonQuery(); conn.Close(); }
public Login() { InitializeComponent(); UsernameTB.Focus(); }