public void Dispose() { RunAsUser = null; Password?.Clear(); ErrorDataReceived = null; OutputDataReceived = null; Exited = null; }
protected virtual void Dispose(bool disposing) { if (!disposing) { return; } // Clear the password. Password?.Clear(); }
public LoginPage LoginGivenUser(AddUser userData) { if (userData == null) { throw new Exception("Given informtaion is not Valid for login"); } UserName.Clear(); UserName.SendKeys(userData.UserName); Password.Clear(); Password.SendKeys(userData.PassWord); AsiNumber.Clear(); AsiNumber.SendKeys(userData.ASINumber); Submit.Click(); Wait.UntilLoading(); if (DriveURL.GetLocalPath() == "/login") { throw new Exception("Unable To Login :" + loginMsg.Text); } LoginUser = userData; return(this); }
private void Registro_Click(object sender, EventArgs e) { // Envia el nombre y la constraseña del registro con el código 1 y separado por / string mensaje = "1/" + Convert.ToString(Username.Text) + "/" + Convert.ToString(Password.Text); byte[] msg = System.Text.Encoding.ASCII.GetBytes(mensaje); server.Send(msg); byte[] msg2 = new byte[80]; server.Receive(msg2); mensaje = Encoding.ASCII.GetString(msg2).Split('/')[0]; if (Convert.ToInt32(mensaje) == 1) { MessageBox.Show("Registrado correctament"); } else { MessageBox.Show("Error al registrarse"); } Username.Clear(); Password.Clear(); }
private void NotificationMessageRecieved(NotificationMessage msg) { Hide(); if (msg.Notification == "FromLogInToHome") { if (HomeScreenView == null) { HomeScreenView = new HomeScreen(); } else { HomeScreenView.Show(); } } else if (msg.Notification == "LogOut") { Password.Clear(); Username.IsReadOnly = true; btnLogOut.Visibility = Visibility.Visible; Show(); } }
/// <summary> /// Email_Button_Click функція, що дає змогу змінити електронну пошту користувача. /// </summary> /// <remarks> /// Сворює дані про нову електронну поштуq,попередньо перевіряючи валідність заповлення полів. /// </remarks> /// <param name="sender">Об'єкт.</param> /// <param name="e">Маршрутизована подія</param> private void Email_Button_Click(object sender, RoutedEventArgs e) { if (Old_Email.Text != "" && Email.Text != "" && Email_check.Text != "") { if (Email.Text == Email_check.Text) { try { string connectionString = ConfigurationManager.ConnectionStrings["MainConnection"].ConnectionString; string query = $"Update Customer Set Email = '{Email.Text}'Where Login = '******'"; using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); SqlCommand command = new SqlCommand(query, connection); command.ExecuteNonQuery(); connection.Close(); } Old_Password.Clear(); Password.Clear(); Password_check.Clear(); } catch (Exception ee) { MessageBox.Show(ee.Message); } } else { MessageBox.Show("Перевірте поля"); } } else { MessageBox.Show("Заповніть всі поля"); } }
private void login_click(object sender, MouseEventArgs e) { var username = UserId.Text; var password = Password.Text; if (string.IsNullOrEmpty(username)) { MessageBox.Show("Please type your Username"); UserId.Focus(); return; } if (string.IsNullOrEmpty(password)) { MessageBox.Show("Please type your Password"); Password.Focus(); return; } // Seperate the login check and make it lously coupled from the UI (= do not refer to the UI elements, instead pass the values to a method) CheckLogin(username, password); Password.Clear(); }
private void doLogin() { try { if (_manager.Login(Login.Text, Password.Text)) { this._user.Login = Login.Text; this._user.UserId = this._userInfoManager.GetUserInfoByLogin(Login.Text).UserID; DialogResult = DialogResult.OK; this.Close(); } else { Program.log.Warn("Logined failed. Login: {0}", (string)Login.Text); MessageBox.Show("User name or password is incorrect"); Password.Clear(); } } catch (Exception exp) { Program.log.Error(exp); } }
public void Create_Existing_Account() { Utils.VisibleElement("Validates the Email Field is visible", Email); Utils.VisibleElement("Validates the Password Field is visible", Password); Email.Clear(); Email.SendKeys(VALUE_EMAIL); //Enter text, Valid Email Utils.Enable("Validates the Next Button is Disable", Next_Button); //Validates, the Next Button is disable Password.Clear(); Password.SendKeys(VALUE_PASS); //Enter text Password Utils.Enable("Validates the Next Button is Enable", Next_Button); //Validates, the Next Button is Enable Next_Button.Click(); //Press Nex button WebDriverWait wait2 = new WebDriverWait(_driver, TimeSpan.FromSeconds(30)); wait2.Until(ExpectedConditions.ElementIsVisible(By.Id("snackbar_text"))); //Wait Until the Text "It looks like you’ve already registered" is visible Utils.VisibleElement("Validates the Error message is visible", Error_Account); Utils.Asserts("Validate the Text Error message is correct", EXPECT_CREATE_COUNT, Utils.Get_Attribute(Error_Account, "text")); //Get and validate the text in to Error message Back_Button.Click(); //Press back Button, to return to the beginning }
public void Button_Click(object sender, RoutedEventArgs e) { if (FirstName.Text.Length > 0 && LastName.Text.Length > 0 && Email.Text.Length > 0) { if (FirstName.Text.Equals(LastName.Text)) { MessageBox.Show("FirstName and LastName should be different"); } else { if (Password.Text.Equals(ConfirmPassword.Text)) { if (Password.Text.Length >= 5) { MessageBox.Show($"Data Added Succefully"); FirstName.Clear(); LastName.Clear(); Email.Clear(); Password.Clear(); ConfirmPassword.Clear(); } else { MessageBox.Show("Please Enter at least 5 values for Password"); } } else { MessageBox.Show("Password and ConfirmPassword are not same"); } } } else { MessageBox.Show("Please Enter All Values"); } }
/// <summary> /// Perform the login action itself /// </summary> public void Login() { try { GenericUtilities.Wait(5); if (UserName.Text.Equals(userName) == false) { if (UserName.Text != "") { UserName.Clear(); } UserName.SendKeys(userName); } if (Password.Text != "") { Password.Clear(); } Password.SendKeys(password); //try //{ // AppiumDriver.Instance.HideKeyboard(); //} //catch //{ } GenericUtilities.Wait(3); //UserName.Click(); //There is an issue with Password field when cursor is in it, unable to click SignIn button, do not remove this. LogInButton.Click(); //LogResults.LogPass("Signed In successfully"); } catch (Exception ex) { //LogResults.LogFail("Failed to Login" + ex.InnerException.Message); } }
public string AddUser(UserRole role, string employeeName, string userName, Status status, string password) { SelectElement select = new SelectElement(Role); select.SelectByText(role.ToString()); EmployeeName.Clear(); EmployeeName.SendKeys(employeeName); UserName.Clear(); UserName.SendKeys(userName); select = new SelectElement(Status); select.SelectByText(status.ToString()); Password.Clear(); Password.SendKeys(userName); ConfirmPassword.Clear(); ConfirmPassword.SendKeys(userName); SaveBtn.Click(); try { return(string.Format("Error validating employee name: {0}", EmpNameValidationError.Text)); } catch (NoSuchElementException) { } try { return(string.Format("Error validating user name: {0}", UsrNameValidationError.Text)); } catch (NoSuchElementException) { } return("Success"); }
private void SignUp_Click(object sender, RoutedEventArgs e) { var username = Username.Text; var password = Password.Password; AuthenticationManager auth = new AuthenticationManager(); var authCred = auth.AuthIsCorrect(username, password); if (authCred == "Incorrect Credentials") { MessageBox.Show("Incorrect Credentials. Please input valid credentials"); Username.Text = ""; Password.Clear(); } else { Cred = authCred; switch (auth.GetRole(Cred)) { case 'C': Home windowHome = new Home(); Application.Current.MainWindow.Close(); windowHome.Show(); break; case 'A': Portal windowPortal = new Portal(); Application.Current.MainWindow.Close(); windowPortal.Show(); break; default: break; } } }
private void TryLogin() { if (string.IsNullOrWhiteSpace(Username)) { Error = "Username is required"; } else if (Password == null) { Error = "Password is required"; } else { try { var user = User.LoadUser(Username, Utilities.SecureStringToString(Password)); if (user != null) { Username = ""; Password.Clear(); Error = ""; PushViewModel(new HomeScreenViewModel(ViewModelChanger) { CurrentUser = user }); } else { Error = "Invalid username or password"; } } catch (Exception e) { Error = "Error: " + e.Message; } } }
private void Reset(object sender, EventArgs e) { Password.Clear(); }
public void SetPassword(string password) { Password.Clear(); Password.SendKeys(password); }
public void Reset() { Password.Clear(); Password.Focus(); }
public void ResetContent() { Password.Clear(); Login.Clear(); }
private void LoginBtn_Click(object sender, EventArgs e) { String name; String password; int count = 0; name = Username.Text; password = Password.Text; if (name == "admin" && password == "123456") { Form1 form = new Form1(); form.Show(); this.Hide(); } else if (name == "admin") { count++; MessageBox.Show("Incorrect password - please try again"); Username.Clear(); Password.Clear(); MessageBox.Show("You have " + (3 - count).ToString() + " attempts left"); if (count == 3) { Application.Exit(); } } else if (password == "123456") { count++; MessageBox.Show("Incorrect name - please try again"); Username.Clear(); Password.Clear(); MessageBox.Show("You have " + (3 - count).ToString() + " attempts left"); if (count == 3) { Application.Exit(); } } else if (name == "" && password == "") { MessageBox.Show("Please enter data into fields"); } else { count++; MessageBox.Show("Incorrect name or password - please try again"); Username.Clear(); Password.Clear(); MessageBox.Show("You have " + (3 - count).ToString() + " attempts left"); if (count == 3) { Application.Exit(); } } }
private void btnOK_Click(object sender, EventArgs e) { if (cmbUsertype.Text == "") { MessageBox.Show("Please select user type", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); cmbUsertype.Focus(); return; } if (UserID.Text == "") { MessageBox.Show("Please enter user ID", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); UserID.Focus(); return; } if (Password.Text == "") { MessageBox.Show("Please enter password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Password.Focus(); return; } try { con = new SqlConnection(cs.DBcon); con.Open(); cmd = con.CreateCommand(); cmd.CommandText = "SELECT RTRIM(UserID),RTRIM(Password) FROM User_Registration where UserID = @d1 and Password=@d2"; cmd.Parameters.AddWithValue("@d1", UserID.Text); cmd.Parameters.AddWithValue("@d2", Password.Text); rdr = cmd.ExecuteReader(); if (rdr.Read()) { con = new SqlConnection(cs.DBcon); con.Open(); cmd = con.CreateCommand(); cmd.CommandText = "SELECT usertype FROM User_Registration where UserID=@d3 and Password=@d4"; cmd.Parameters.AddWithValue("@d3", UserID.Text); cmd.Parameters.AddWithValue("@d4", Password.Text); rdr = cmd.ExecuteReader(); if (rdr.Read()) { cmbUsertype.Text = rdr.GetValue(0).ToString().Trim(); } if ((rdr != null)) { rdr.Close(); } if (con.State == ConnectionState.Open) { con.Close(); } if (cmbUsertype.Text == "Librarian") { this.Hide(); Librarian_Window frm = new Librarian_Window(); frm.User.Text = UserID.Text; frm.UserType.Text = cmbUsertype.Text; frm.Show(); ProgressBar1.Visible = true; ProgressBar1.Maximum = 5000; ProgressBar1.Minimum = 0; ProgressBar1.Value = 4; ProgressBar1.Step = 1; for (int i = 0; i <= 5000; i++) { ProgressBar1.PerformStep(); } } if (cmbUsertype.Text == "Account Officer") { this.Hide(); Account_Officer_Window frm = new Account_Officer_Window(); frm.User.Text = UserID.Text; frm.UserType.Text = cmbUsertype.Text; frm.Show(); ProgressBar1.Visible = true; ProgressBar1.Maximum = 5000; ProgressBar1.Minimum = 0; ProgressBar1.Value = 4; ProgressBar1.Step = 1; for (int i = 0; i <= 5000; i++) { ProgressBar1.PerformStep(); } /*st1 = UserID.Text; * st2 = "Successfully logged in"; * cf.LogFunc(st1, System.DateTime.Now, st2); * this.Hide(); * frm.Show();*/ } if (cmbUsertype.Text == "Admin") { this.Hide(); frm_Main_Menu frm = new frm_Main_Menu(); //frm.User.Text = txtUserName.Text; frm.User.Text = UserID.Text; frm.UserType.Text = cmbUsertype.Text; frm.Show(); // frm.registrationToolStripMenuItem2.Enabled = true; frm.studentDetailsToolStripMenuItem.Enabled = true; frm.hostelersToolStripMenuItem.Enabled = true; frm.busHoldersToolStripMenuItem.Enabled = true; frm.Master_entryMenu.Enabled = true; frm.usersToolStripMenuItem.Enabled = true; frm.studentToolStripMenuItem.Enabled = true; frm.employeeToolStripMenuItem.Enabled = true; frm.transactionToolStripMenuItem.Enabled = true; frm.searchToolStripMenuItem.Enabled = true; frm.reportToolStripMenuItem.Enabled = true; frm.busFeePaymentToolStripMenuItem2.Enabled = true; frm.feePaymentToolStripMenuItem.Enabled = true; frm.employeeSalaryToolStripMenuItem.Enabled = true; frm.hostelFeesPaymentToolStripMenuItem.Enabled = true; frm.scholarshipPaymentToolStripMenuItem.Enabled = true; ProgressBar1.Visible = true; ProgressBar1.Maximum = 5000; ProgressBar1.Minimum = 0; ProgressBar1.Value = 4; ProgressBar1.Step = 1; for (int i = 0; i <= 5000; i++) { ProgressBar1.PerformStep(); } st1 = UserID.Text; st2 = "Successfully logged in"; cf.LogFunc(st1, System.DateTime.Now, st2); this.Hide(); frm.Show(); } } else { MessageBox.Show("Login Failed...Try again !", "Login Denied", MessageBoxButtons.OK, MessageBoxIcon.Error); UserID.Clear(); Password.Clear(); UserID.Focus(); } con.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void User_SelectedIndexChanged(object sender, EventArgs e) { Password.Clear(); }
public void ResetContent() { Login.Clear(); Password.Clear(); Email.Clear(); }
public DialogResult ShowDialog(IWin32Window owner) { if (String.IsNullOrEmpty(_targetName)) { throw new ArgumentNullException("TargetName"); } DialogResult result; int passwordMaxLength = CREDUI_MAX_PASSWORD_LENGTH + 1; StringBuilder username = new StringBuilder(_userName, CREDUI_MAX_USERNAME_LENGTH); SafeBitmapHandle banner = _banner != null ? new SafeBitmapHandle(_banner.GetHbitmap(), true) : new SafeBitmapHandle(IntPtr.Zero, false); SafeUnmanagedBuffer password = new SafeUnmanagedBuffer(passwordMaxLength * sizeof(char)); for (int i = 0; i < sizeof(char); i++) { password[i] = 0; } CheckNotDisposed(); var info = new NativeMethods.CREDUI_INFO() { hwndParent = owner != null ? owner.Handle : IntPtr.Zero, hbmBanner = banner.DangerousGetHandle(), pszCaptionText = _caption, pszMessageText = _message }; info.cbSize = Marshal.SizeOf(info); try { var nativeResult = NativeMethods.CredUIPromptForCredentials(ref info, _targetName, IntPtr.Zero, 0, username, CRED_MAX_USERNAME_LENGTH, new HandleRef(password, password.DangerousGetHandle()), passwordMaxLength, ref _saveChecked, _options); /*IntPtr outBuffer; * uint authPackage = 0; * uint outBufferSize; * info.hbmBanner = IntPtr.Zero; * nativeResult = NativeMethods.CredUIPromptForWindowsCredentials(ref info, 0, ref authPackage, new HandleRef(null, IntPtr.Zero), 0, out outBuffer, out outBufferSize, ref _saveChecked, * 0x1 | 0x200); * * int nameLen = 0, passLen = 0, dNameLength = 0; * NativeMethods.CredUnPackAuthenticationBuffer(0, outBuffer, (int)outBufferSize, null, ref nameLen, null, ref dNameLength, null, ref passLen); * StringBuilder sName = new StringBuilder(nameLen), sPass = new StringBuilder(passLen), dName = new StringBuilder(dNameLength); * bool pos = NativeMethods.CredUnPackAuthenticationBuffer(0, outBuffer, (int)outBufferSize, sName, ref nameLen, * dName, ref dNameLength, sPass, ref passLen); * * * var b = new SafeCoUnmanagedBuffer(outBuffer, checked((int)outBufferSize), true); * * string s = Marshal.PtrToStringUni(outBuffer);*/ switch (nativeResult) { case NativeMethods.CredUIReturnCodes.NO_ERROR: _userName = username.ToString(); Password.Clear(); byte[] unicodeBytes = new byte[sizeof(char)]; char currentChar = Char.MaxValue; for (int i = 0; ;) { for (int j = 0; j < sizeof(char); j++) { unicodeBytes[j] = password[i]; password[i++] = 0; } if ((currentChar = Encoding.Unicode.GetChars(unicodeBytes)[0]) != '\0') { Password.AppendChar(currentChar); } else { break; } } result = DialogResult.OK; break; case NativeMethods.CredUIReturnCodes.ERROR_CANCELLED: result = DialogResult.Cancel; break; default: throw new Win32Exception((int)nativeResult); } } finally { banner.Dispose(); password.Dispose(); } return(result); }
protected override void OnRender(DrawingContext drawingContext) { base.OnRender(drawingContext); Password.Clear(); }
private void ClearTextBoxes() { Login.Clear(); Password.Clear(); SecondPassword.Clear(); }
private void login_Click(object sender, EventArgs e) { #region 单选框 //if (Teacher.Checked) //{ // if (Acount.Text.Length <= 0 || Password.Text.Length <= 0) // { // MessageBox.Show("账号或者密码不能为空"); // } // if (Acount.Text == "Teacher" && Password.Text == "Teacher") // { // MessageBox.Show("老师登录成功"); // } // else // { // MessageBox.Show("你的账号或者密码出错"); // Acount.Clear();//清空输入的账号 // Password.Clear();//清空输入的密码 // Acount.Focus(); //获取焦点 // } //} //else //{ // if (Acount.Text.Length <= 0 || Password.Text.Length <= 0) // { // MessageBox.Show("账号或者密码不能为空"); // } // if (Acount.Text == "Student" && Password.Text == "Student") // { // MessageBox.Show("学生登录成功"); // } // else // { // MessageBox.Show("你的账号或者密码出错"); // Acount.Clear();//清空输入的账号 // Password.Clear();//清空输入的密码 // Acount.Focus(); //获取焦点 // } //} #endregion #region 多选框 if (ckTeacher.Checked) { if (Acount.Text.Length <= 0 || Password.Text.Length <= 0) { MessageBox.Show("账号或者密码不能为空"); } if (Acount.Text == "Teacher" && Password.Text == "Teacher") { MessageBox.Show("老师登录成功"); } else { MessageBox.Show("你的账号或者密码出错"); Acount.Clear(); //清空输入的账号 Password.Clear(); //清空输入的密码 Acount.Focus(); //获取焦点 } } else { if (Acount.Text.Length <= 0 || Password.Text.Length <= 0) { MessageBox.Show("账号或者密码不能为空"); } if (Acount.Text == "Student" && Password.Text == "Student") { MessageBox.Show("学生登录成功"); } else { MessageBox.Show("你的账号或者密码出错"); Acount.Clear(); //清空输入的账号 Password.Clear(); //清空输入的密码 Acount.Focus(); //获取焦点 } } #endregion }
private void Ocistit(object sender, RoutedEventArgs e) { Password.Clear(); Email.Clear(); Name.Clear(); }
private void btn_clear_Click(object sender, RoutedEventArgs e) { Host.Text = Login.Text = ""; Password.Clear(); }
public void FillPassword() { Password.Clear(); Password.SendKeys("1111"); }
private void Button_Click_1(object sender, RoutedEventArgs e) { Username.Clear(); Password.Clear(); }