private void BtnLogin_Click(object sender, EventArgs e) { while (attempt <= maxattempts) { if (TxtUser.Text != username) { MessageBox.Show("invalid username," + (maxattempts - attempt) + "attempt remaining"); TxtUser.Clear(); attempt++; return; } else { if (TxtPassword.Text != "1234") { attempt++; MessageBox.Show("incorrect password," + (maxattempts - attempt) + "attempt remaining"); TxtPassword.Clear(); return; } else { attempt = 0; MessageBox.Show("Login successfull"); BtnLogin.Text = "Logout"; break; } } } }
private void _ingresar() { if (!_validar()) { return; } if (Usuario.Ingresar(ref _modelo)) { ModuloGeneral.UsuarioActivo = _modelo; ModuloGeneral.FrmLogin = this; TxtNombreUsuario.Focus(); TxtNombreUsuario.Clear(); TxtPassword.Clear(); FrmMDI frmMDI = new FrmMDI(); ModuloGeneral.FrmMDI = frmMDI; frmMDI.Show(); Visible = false; } else { MessageBox.Show(BaseDeDatos.Core.ConexionBaseDeDatos.Error, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void BtnLogin_Click(object sender, EventArgs e) { bool logged = false; if ((TxtUsername.Text.Length > 0) && (TxtPassword.Text.Length > 0)) { foreach (string[] login in lm.Logins) { if ((login[0].ToLower() == TxtUsername.Text.ToLower()) && (login[1] == cipher.Shift(TxtPassword.Text, 3))) { logged = true; MessageBox.Show("Successful Login", "Login Attempt", MessageBoxButtons.OK, MessageBoxIcon.Information); FrmWelcomeScreen welcomeScreen = new FrmWelcomeScreen(pm.IsAboveOfficer(login[0]), login[0]); this.Hide(); welcomeScreen.ShowDialog(); this.Close(); } } } if (!logged) { MessageBox.Show("Wrong credentials"); TxtPassword.Clear(); TxtUsername.Clear(); } }
private void BtnGuardar_Click(object sender, EventArgs e) { if (TxtPassword.Text == TxtPassword2.Text) { if (TxtUsuario.Text != "" || TxtPassword.Text != "" || TxtPassword2.Text != "") { Usuarios n = new Usuarios(TxtUsuario.Text, TxtPassword.Text, TxtNombre.Text, TxtEmail.Text, "11", Convert.ToInt32(CmbTipoCuenta.SelectedValue)); Boolean resp = n.Guardar(); if (resp) { MessageBox.Show("Se ha guardado el usuario con exito", "Guardado con exito", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtEmail.Clear(); TxtNombre.Clear(); TxtPassword.Clear(); TxtPassword2.Clear(); TxtUsuario.Clear(); } else { MessageBox.Show("Error al guardar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("No se permiten campos vacios", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Las contraseñas no coinciden", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Clear() { TxtFullName.Clear(); TxtPhone.Clear(); TxtUserEmail.Clear(); TxtPassword.Clear(); }
private void BtnLogin_Click(object sender, EventArgs e) { int PassResult = 0; int TotalUsers = 0; clsEmployee clsEmployee = new clsEmployee(); TotalUsers = clsEmployee.GetAllUserTotal(1); PassResult = clsEmployee.GetLoginUserID(TxtUserName.Text.TrimEnd(), TxtPassword.Text.TrimEnd()); if ((PassResult != 0) && (TotalUsers != 0)) { FrmMain frmMain = new FrmMain(); frmMain.RefToLoginForm = this; frmMain.UserID = PassResult; frmMain.Show(); this.Hide(); } else { DialogResult dialog = MessageBox.Show("Unknown User and do you wish to add new user?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Error); if (dialog == DialogResult.Yes) { FrmEmployee frmEmployee = new FrmEmployee(); frmEmployee.ShowDialog(); Application.Exit(); } else { TxtUserName.Clear(); TxtPassword.Clear(); TxtUserName.Select(); } } }
private void InisiarSesion() { DataBaseControl DBControl = new DataBaseControl(DataBaseControl.cPath, "ProjectDataBase.mdf"); string[] parameters = { "@id", "@pass" }; string[] elements = { TxtUserName.Text, TxtPassword.Text }; TxtUserName.Clear(); TxtPassword.Clear(); List <string> admins = new List <string> { "Admin", "Develop" }; if (DBControl.Buscar("select * from Users where [UserName]=@id and [KeyWord]=@pass", parameters, elements)) { string cat = DBControl.BuscarElemento("select [Category] from Users where [UserName]=@id and [KeyWord]=@pass", parameters, elements); MainPageForm mainPage = new MainPageForm(cat); this.Hide(); mainPage.ShowDialog(); this.Show(); TxtUserName.Focus(); } else { MessageBox.Show("Usuario o contraseña inválidos"); TxtUserName.Focus(); } }
private void TxtsResetter() { TxtIpAddress.Clear(); TxtDatabaseName.Clear(); TxtUsername.Clear(); TxtPassword.Clear(); TxtIpAddress.Focus(); }
public void ClearEmployeeView() { TxtName.Clear(); TxtEmail.Clear(); TxtPhone.Clear(); TxtNoOfHours.Clear(); ChkIsAdmin.IsChecked = false; ChkIsActive.IsChecked = true; TxtUsername.Clear(); TxtPassword.Clear(); }
//reset method private void Reset() { TxtName.Clear(); TxtSurname.Clear(); TxtUsername.Clear(); TxtPassword.Clear(); CbxPosition.SelectedItem = null; BtnUpdate.Visibility = Visibility.Hidden; BtnDelete.Visibility = Visibility.Hidden; BtnRead.Visibility = Visibility.Hidden; }
public LoginPage LoginInvalid(string username, string password) { //submit creds TxtUsername.Clear(); TxtUsername.SendKeys(username); TxtPassword.Clear(); TxtPassword.SendKeys(password); BtnLogin.Click(); //homepage return return(this); }
public HomePage Login(string username, string password) { //submit creds TxtUsername.Clear(); TxtUsername.SendKeys(username); TxtPassword.Clear(); TxtPassword.SendKeys(password); BtnLogin.Click(); //homepage return return(new HomePage()); }
private void Reset() { TxtName.Clear(); TxtSurname.Clear(); TxtLogin.Clear(); TxtPassword.Clear(); BtnCreate.Visibility = Visibility.Visible; BtnUpdate.Visibility = Visibility.Hidden; BtnDelete.Visibility = Visibility.Hidden; FillUsers(); }
/// <summary> /// Method TryLogin /// Gets login and password, and try login in site. /// </summary> /// <param name="login">String with login</param> /// <param name="password">String with password.</param> /// <returns>Answers whether you managed to enter.</returns> public bool TryLogin(string login, string password) { WaitUntil(TxtLogin).Click(); TxtLogin.Clear(); TxtLogin.SendKeys(login); WaitUntil(TxtPassword).Click(); TxtPassword.Clear(); TxtPassword.SendKeys(password); WaitUntil(BtnLogin).Click(); return(Browser.WebDriver.Url.Contains(BuyTicketPage.Url)); }
private void TxtUserName_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { DataTable dt = new DataTable(); using (var con = new MySqlConnection(GetConnection())) { try { con.Open(); using (var com = new MySqlCommand($"SELECT * FROM `tbllogin` WHERE `Username`=sha('{TxtUserName.Text}') and `Password`=sha('{TxtPassword.Text}')", con)) { com.CommandType = CommandType.Text; dr = (MySqlDataReader)com.ExecuteReader(); if (dr.Read()) { MessageBox.Show("Access Granted. Welcome!", "Login Success", MessageBoxButtons.OK, MessageBoxIcon.Information); Hide(); HomeForm obj = new HomeForm(); obj.Show(); } else { MessageBox.Show("Wrong Username or Password! Please try again.", "Login Failed", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtPassword.Clear(); } } } catch (Exception) { } finally { dr.Close(); con.Close(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
//Textbox Value Reset private void Reset() { TxtName.Clear(); TxtSurname.Clear(); TxtPhone.Clear(); TxtEmail.Clear(); TxtPassword.Clear(); BtnCreate.Visibility = Visibility.Visible; BtnUpdate.Visibility = Visibility.Hidden; BtnDelete.Visibility = Visibility.Hidden; FillCustomerData(); }
// TextBox Reset private void Reset() { TxtEmail.Clear(); TxtName.Clear(); TxtPassword.Clear(); TxtPhoneNumber.Clear(); TxtSurname.Clear(); BtnCreate.Visibility = Visibility.Visible; BtnUpdate.Visibility = Visibility.Hidden; BtnDelete.Visibility = Visibility.Hidden; FillManagers(); }
private void BtnLogin_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(TxtUsername.Text) && !string.IsNullOrEmpty(TxtPassword.Text)) { SqlConnection sqlConn = new SqlConnection("Data Source=DESKTOP-0997K4M;Initial Catalog=UserRegistrationDB;Integrated Security=True"); SqlCommand sqlComm = new SqlCommand("SELECT * FROM tblUser WHERE EmailAddress = @EmailAddress and Password = @Password", sqlConn); sqlConn.Open(); SqlDataAdapter dataAdapter = new SqlDataAdapter(); DataTable dataTable = new DataTable(); sqlComm.Parameters.AddWithValue("@EmailAddress", TxtUsername.Text); sqlComm.Parameters.AddWithValue("@Password", TxtPassword.Text); DataSet dataSet = new DataSet(); dataAdapter.SelectCommand = sqlComm; dataAdapter.Fill(dataTable); if (dataTable.Rows.Count > 0) { TxtUsername.Clear(); TxtPassword.Clear(); ChckShowPassword.Checked = false; this.Hide(); BCMainForm mainForm = new BCMainForm(); mainForm.ShowDialog(); mainForm = null; this.Hide(); this.TxtUsername.Select(); } else { //show error message MessageBox.Show("Username or Password incorrect. Try Agian", "Login form", MessageBoxButtons.OK, MessageBoxIcon.Stop); TxtUsername.Focus(); TxtUsername.SelectAll(); } } else { MessageBox.Show("Please enter username and password. ", "Create Account", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TxtUsername.Select(); } }
public RegisterPage RegisterInvalid(string email, string password, string confirm, string pid) { //input data TxtEmail.Clear(); TxtEmail.SendKeys(email); TxtPassword.Clear(); TxtPassword.SendKeys(password); TxtConfirmPassword.Clear(); TxtConfirmPassword.SendKeys(confirm); TxtPIDPassport.Clear(); TxtPIDPassport.SendKeys(pid); //submit BtnRegister.Click(); //return thank you page return(this); }
private void BtnSignIn_Click(object sender, RoutedEventArgs e) { //Admin login if (TxtEmail.Text == "admin" && TxtPassword.Password == "12345") { AdminPanel adminPanel = new AdminPanel(); adminPanel.ShowDialog(); TxtEmail.Clear(); TxtPassword.Clear(); return; } //Manager login Database if (string.IsNullOrEmpty(TxtEmail.Text)) { MessageBox.Show("E-poçt ünvani boş ola bilməz"); return; } else if (!Regex.IsMatch(TxtEmail.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$")) { MessageBox.Show("E-poçt ünvani düzgün yazın"); TxtEmail.Select(0, TxtEmail.Text.Length); TxtEmail.Focus(); return; } else if (string.IsNullOrEmpty(TxtPassword.Password)) { MessageBox.Show("Şifrə boş ola bilməz"); return; } var modelEmail = _libraryContext.Managers.FirstOrDefault(m => m.Email == TxtEmail.Text); if (modelEmail == null || modelEmail.Password != TxtPassword.Password) { MessageBox.Show("E-poçt ünvani və ya Şifrə yanlışdır"); return; } else { DashboardWindow dashboard = new DashboardWindow(); dashboard.Show(); this.Close(); } }
private void BtnLogin_Click(object sender, EventArgs e) { if (UserType.Text == "") { MessageBox.Show("Please Select User Type", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserType.Focus(); return; } if (TxtUserName.Text == "") { MessageBox.Show("Please Enter User Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtUserName.Focus(); return; } if (TxtPassword.Text == "") { MessageBox.Show("Please Enter Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtUserName.Focus(); return; } cmd = new OleDbCommand("SELECT * FROM Login WHERE UserName LIKE @UserName And Password LIKE @Password And UserType LIKE @UserType", con); cmd.Parameters.AddWithValue("@UserName", TxtUserName.Text); cmd.Parameters.AddWithValue("@Password", TxtPassword.Text); cmd.Parameters.AddWithValue("@UserType", UserType.Text); OleDbDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { FrmMDIMain f = new FrmMDIMain(); f.UserName.Text = this.TxtUserName.Text.ToUpper(); f.Designation.Text = this.UserType.Text.ToUpper(); if (UserType.Text == "Administrator") { f.BtnNewUserCreation.Visible = true; } this.Hide(); f.Visible = true; } else { MessageBox.Show("Login Failed...Try again !", "Login Denied", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtUserName.Clear(); TxtPassword.Clear(); TxtUserName.Focus(); } }
private void BtnLogin_Click(object sender, EventArgs e) { if (!loggedIn) { while (attempt <= MaxAttempts) { if (TxtUser.Text != username) { MessageBox.Show("Invalid username, " + (MaxAttempts - attempt) + " attempts remaining"); attempt++; return; } else { if (TxtPassword.Text != myPassword) { attempt++; MessageBox.Show("Incorrect password," + (MaxAttempts - attempt) + " attempts remaining"); return; } else { attempt = 1; loggedIn = true; MessageBox.Show("Hi " + username + ", your login successful"); BtnLogin.Text = "Logout"; break; } } } } else { BtnLogin.Text = "Login"; loggedIn = false; TxtUser.Clear(); TxtPassword.Clear(); } }
public RegisterPage RegisterInvalid(User user) { //input data TxtEmail.Clear(); TxtEmail.SendKeys(user.Email); TxtPassword.Clear(); TxtPassword.SendKeys(user.Password); TxtConfirmPassword.Clear(); TxtConfirmPassword.SendKeys(user.PasswordConfirm); TxtPIDPassport.Clear(); TxtPIDPassport.SendKeys(user.Pid); //submit BtnRegister.Click(); //return error page return(this); }
public ThankYouRegisterPage Register(User user) { //input data TxtEmail.Clear(); TxtEmail.SendKeys(user.Email); TxtPassword.Clear(); TxtPassword.SendKeys(user.Password); TxtConfirmPassword.Clear(); TxtConfirmPassword.SendKeys(user.PasswordConfirm); TxtPIDPassport.Clear(); TxtPIDPassport.SendKeys(user.Pid); //submit BtnRegister.Click(); //return thank you page return(new ThankYouRegisterPage()); }
private void textBox3_TextChanged(object sender, EventArgs e) { PicPassword.BackgroundImage = Properties.Resources.login_profile; //image location TxtPassword.Clear(); //clear text content in textbox when click event occurs TxtPassword.PasswordChar = '*'; //encrypt password with asterics for security reason //flowLayoutPanel1.BackColor = Color.FromArgb(78, 184, 206); //TxtPassword.ForeColor = Color.FromArgb(78, 184, 206); //pictureBox4.BackgroundImage = Properties.Resources.IT_Student_2_20181107_222013; //flowLayoutPanel2.BackColor = Color.WhiteSmoke; //TxtPassword.ForeColor = Color.WhiteSmoke; //pictureBox4.BackgroundImage = Properties.Resources.password; //flowLayoutPanel3.BackColor = Color.WhiteSmoke; //TxtPassword.ForeColor = Color.WhiteSmoke; }
private void ReBind() { TxtPassword.Clear(); TxtDescription.Text = "You have no password associated with this PDF. If it is a password protected PDF, enter the password in the box below."; AugmentedBindable <PDFDocument> pdf_document_bindable = DataContext as AugmentedBindable <PDFDocument>; if (null != pdf_document_bindable) { PDFDocument pdf_document = pdf_document_bindable.Underlying; string password = pdf_document.GetPassword(); if (!String.IsNullOrEmpty(password)) { TxtDescription.Text = "You have a password associated with this PDF. Enter a new one in the box below or clear it with the Forget button."; } } }
/// <summary> /// Submits the login form /// </summary> /// <remarks>Miguel Santana 2015/05/03</remarks> private void Submit() { if (Convert.ToBoolean(ConfigurationManager.AppSettings["Debug"])) { Globals.UserToken = new Employee(100, "Debugger", null, 1); } int userId; if (!int.TryParse(TxtUserName.Text.Trim(), out userId)) { throw new InputValidationException(TxtUserName, "Please enter your User ID.", "Login Error"); } var password = TxtPassword.Password.Trim(); if (string.IsNullOrEmpty(password) || password.ValidatePassword()) { throw new InputValidationException(TxtPassword, "Please enter your Password.", "Login Error"); } try { TxtPassword.Clear(); Globals.UserToken = new EmployeeManager().GetEmployeeLogin(userId, password); } catch (ApplicationException ex) { throw new InputValidationException(TxtPassword, ex, "Login Error"); } if (Globals.UserToken == null) { throw new WanderingTurtleException(this, "Error setting User Token"); } var window = this.GetVisualParent <MainWindow>(); window.BtnSignOut.Visibility = Visibility.Visible; window.MainContent.Content = new TabContainer(); myTimer.Stop(); }
private void bunifuButton1_Click(object sender, EventArgs e) { try { SqlConnection myConnection = default(SqlConnection); myConnection = new SqlConnection(@"Data Source=DESKTOP-NP1RDM2\BAZALUIMARIAN;Initial Catalog=task;Persist Security Info=True;User ID=sa; Password = 0299"); { String query = "INSERT INTO dbo.Users (NameUser,PasswordUser,UserA) VALUES (@UserName,@Password,@UserA)"; using (SqlCommand command = new SqlCommand(query, con)) { command.Parameters.AddWithValue("@UserName", TxtUserName.Text); command.Parameters.AddWithValue("@Password", TxtPassword.Text); command.Parameters.AddWithValue("@UserA", TxtUserA.Text); MessageBox.Show("Save with successfully !", "Save with successfully", MessageBoxButtons.OK, MessageBoxIcon.Error); con.Open(); int result = command.ExecuteNonQuery(); // Check Error if (result < 0) { MessageBox.Show("Save with successfully", "Save with successfully", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtUserName.Clear(); TxtUserA.Clear(); TxtPassword.Clear(); TxtUserName.Focus(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void MenuBtn_Click(object sender, EventArgs e) { switch ((sender as Button).Name) { case "BtnServer": TabControlCenter.SelectedTab = TabControlCenter.TabPages[0]; break; case "BtnSchools": TabControlCenter.SelectedTab = TabControlCenter.TabPages[1]; Schools(); break; case "BtnLock": TxtUsername.Clear(); TxtPassword.Clear(); PanelLocked.Show(); break; case "BtnExit": Close(); break; case "BtnMadeBy": new MadeBy().ShowDialog(); break; case "newschoolbtn": TabControlCenter.SelectedTab = TabControlCenter.TabPages[2]; break; case "BtnNewSchoolNext": TabControlCenter.SelectedTab = TabControlCenter.TabPages[3]; break; case "BtnSettings": TabControlCenter.SelectedTab = TabControlCenter.TabPages[4]; break; } }
private void BtnLogin_Click(object sender, EventArgs e) { if (TxtUser.Text != "user") { if (TxtPassword.Text != "password") { Administrator administrator = new Administrator(TxtUser.Text, TxtPassword.Text); LoginAnswer answer = administratorService.Login(administrator); if (answer.Error == false) { if (answer.ValidData) { PrincipalFrm principalFrm = new PrincipalFrm(); principalFrm.Show(); this.Hide(); } else { answer.Message = "Usuario y/o Contraseña incorrecta. intente de nuevo!"; MessageError(answer.Message); TxtPassword.Clear(); TxtPassword.Focus(); } } else { MessageBox.Show(answer.Message); } } else { MessageError("Por favor digite su CONTRASEÑA"); } } else { MessageError("Por favor digite su USUARIO"); } }