private void TextBoxID_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) // 엔터 { TextBoxPassword.Focus(); } }
private bool CheckedUser() { String strName = TextBoxName.Text.Trim(); if (_strDic.Count > 0 && _strDic.ContainsKey(strName)) { MessageBox.Show("用户名【" + strName + "】已经存在,请重新输入!", "操作提示"); return(false); } if (!strName.Equals("260905")) { if (strName.Equals(string.Empty)) { TextBoxName.Clear(); TextBoxName.Focus(); MessageBox.Show("用户名不能为空!", "操作提示"); return(false); } else if (TextBoxPassword.Text.Trim().Equals(string.Empty)) { TextBoxPassword.Clear(); TextBoxPassword.Focus(); MessageBox.Show("密码不能为空!", "操作提示"); return(false); } } else { MessageBox.Show("不能创建该用户!", "操作提示"); return(false); } return(true); }
private async void BtnLogin_Click(object sender, RoutedEventArgs e) { var email = TextBoxEmail.Text; if (string.IsNullOrEmpty(email) || !Regex.IsMatch(email, @".*@.*\..*")) { DisplayLoginError("Please enter an valid email address"); return; } if (string.IsNullOrEmpty(TextBoxPassword.Password)) { DisplayLoginError("Please enter a password"); return; } IsEnabled = false; _controller = await this.ShowProgressAsync("Logging in...", ""); var result = await HearthStatsAPI.LoginAsync(TextBoxEmail.Text, TextBoxPassword.Password); TextBoxPassword.Clear(); if (result.Success) { StartMainApp(); } else if (result.Message.Contains("401")) { DisplayLoginError("Invalid email or password"); } else { DisplayLoginError(result.Message); } }
private void TextBoxAccount_OnKeyDown(object sender, KeyRoutedEventArgs e) { if (e.Key == VirtualKey.Enter) { TextBoxPassword.Focus(FocusState.Keyboard); } }
// Enables/disables the form controls to prevent button spamming. private void SetControls(bool isEnabled) { if (InvokeRequired) { Invoke(new SetControlsDelegate(SetControls), isEnabled); } else { TextBoxUsername.Enabled = isEnabled; TextBoxPassword.Enabled = isEnabled; CheckBoxRememberMe.Enabled = isEnabled; ButtonLogin.Enabled = isEnabled; ButtonCreateAccount.Enabled = isEnabled; ButtonRecoverAccount.Enabled = isEnabled; if (!isEnabled) { TextBoxUsername.BackColor = Color.White; TextBoxPassword.BackColor = Color.White; } else { TextBoxPassword.Clear(); ActiveControl = TextBoxPassword; } } }
private void Clear() { TextBoxId.Clear(); TextBoxUserName.Clear(); TextBoxPassword.Clear(); ComboBoxAdmin.SelectedIndex = -1; }
//Init public LoginWindow(Canvas parent, MainMenu mainMenu, ImagePanel parentPanel) { //Assign References mMainMenu = mainMenu; //Main Menu Window mLoginWindow = new ImagePanel(parent, "LoginWindow"); //Menu Header mLoginHeader = new Label(mLoginWindow, "LoginHeader"); mLoginHeader.SetText(Strings.Login.title); mUsernameBackground = new ImagePanel(mLoginWindow, "UsernamePanel"); //Login Username Label mUsernameLabel = new Label(mUsernameBackground, "UsernameLabel"); mUsernameLabel.SetText(Strings.Login.username); //Login Username Textbox mUsernameTextbox = new TextBox(mUsernameBackground, "UsernameField"); mUsernameTextbox.SubmitPressed += UsernameTextbox_SubmitPressed; mUsernameTextbox.Clicked += _usernameTextbox_Clicked; mPasswordBackground = new ImagePanel(mLoginWindow, "PasswordPanel"); //Login Password Label mPasswordLabel = new Label(mPasswordBackground, "PasswordLabel"); mPasswordLabel.SetText(Strings.Login.password); //Login Password Textbox mPasswordTextbox = new TextBoxPassword(mPasswordBackground, "PasswordField"); mPasswordTextbox.SubmitPressed += PasswordTextbox_SubmitPressed; mPasswordTextbox.TextChanged += _passwordTextbox_TextChanged; //Login Save Pass Checkbox mSavePassChk = new LabeledCheckBox(mLoginWindow, "SavePassCheckbox") { Text = Strings.Login.savepass }; //Forgot Password Button mForgotPassswordButton = new Button(mLoginWindow, "ForgotPasswordButton"); mForgotPassswordButton.IsHidden = true; mForgotPassswordButton.SetText(Strings.Login.forgot); mForgotPassswordButton.Clicked += mForgotPassswordButton_Clicked; //Login - Send Login Button mLoginBtn = new Button(mLoginWindow, "LoginButton"); mLoginBtn.SetText(Strings.Login.login); mLoginBtn.Clicked += LoginBtn_Clicked; //Login - Back Button mBackBtn = new Button(mLoginWindow, "BackButton"); mBackBtn.SetText(Strings.Login.back); mBackBtn.Clicked += BackBtn_Clicked; LoadCredentials(); mLoginWindow.LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString()); }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { _dbReactor.AddUser(TextBoxName.Text.ToUpper(), TextBoxPassword.Text.ToUpper()); lableAnswer.Content = $"User {TextBoxName.Text} created"; TextBoxName.Clear(); TextBoxPassword.Clear(); }
private void TextBoxAccount_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { TextBoxPassword.Focus(); } }
public void ClearUsersTextBox() { TextBoxName.Clear(); TextBoxPassword.Clear(); RadioAdmi.IsChecked = false; RadioUser.IsChecked = false; }
/// <summary> /// Allows the other pages to return to this initial screen. /// </summary> public void GoBack() { TextBoxEmail.Clear(); TextBoxPassword.Clear(); LabelAlert.Content = ""; Content = content; }
public void TextBoxUsername_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { TextBoxPassword.Focus(); e.Handled = true; } }
private void TextBoxPassword_Enter(object sender, EventArgs e) { if (TextBoxPassword.ForeColor == Color.DimGray && TextBoxPassword.Text == "Password") { TextBoxPassword.Clear(); TextBoxPassword.ForeColor = Color.Black; TextBoxPassword.UseSystemPasswordChar = true; } }
private void CheckBoxUseVirtualAccount_OnUnchecked(object sender, RoutedEventArgs e) { TextBoxUsername.IsReadOnly = false; TextBoxUsername.Foreground = Brushes.Black; TextBoxUsername.BorderBrush = Brushes.DarkGray; TextBoxUsername.Clear(); TextBoxPassword.Clear(); }
/// <summary> /// Displays requested screen section based on received request. /// </summary> private void ManageScreenVisualization() { // Initially hide everything on all screens LoginSection.Visibility = Visibility.Collapsed; AccessDeniedSection.Visibility = Visibility.Collapsed; ChangePasswordSection.Visibility = Visibility.Collapsed; TextBlockApplicationLogin.Visibility = Visibility.Collapsed; TextBlockAccessDenied.Visibility = Visibility.Collapsed; TextBlockChangePassword.Visibility = Visibility.Collapsed; // Reset all default buttons ButtonLogin.IsDefault = false; ButtonOK.IsDefault = false; ButtonChange.IsDefault = false; if (m_displayType == DisplayType.Login) { TextBoxPassword.Password = ""; ButtonLogin.IsDefault = true; TextBlockApplicationLogin.Visibility = Visibility.Visible; LoginSection.Visibility = Visibility.Visible; if (string.IsNullOrWhiteSpace(TextBoxUserName.Text)) { TextBoxUserName.Focus(); } else { TextBoxPassword.Focus(); } } else if (m_displayType == DisplayType.AccessDenied) { ButtonOK.IsDefault = true; TextBlockAccessDenied.Visibility = Visibility.Visible; AccessDeniedSection.Visibility = Visibility.Visible; } else if (m_displayType == DisplayType.ChangePassword) { TextBoxOldPassword.Password = ""; TextBoxNewPassword.Password = ""; TextBoxConfirmPassword.Password = ""; ButtonChange.IsDefault = true; TextBlockChangePassword.Visibility = Visibility.Visible; ChangePasswordSection.Visibility = Visibility.Visible; if (string.IsNullOrWhiteSpace(TextBoxChangePasswordUserName.Text)) { TextBoxChangePasswordUserName.Focus(); } else { TextBoxOldPassword.Focus(); } } }
/// <summary> /// Verify that the user's account exists on the Unity Connection server and that they have administrator rights. The login /// to CUPI for admins will fail otherwise. /// If the login goes through add the user information to the session variable - this doesn't get used for anything other than /// as verification that the currently logged in user is authenticated - the credentials have to be resent with each CUPI command /// regardless. This just makes sure the user isn't getting cute and going directly to the user selection page. /// </summary> protected void ButtonLogin_Click(object sender, EventArgs e) { ConnectionServerRest currentConnectionServer; //check for empty strings - yes, you can use ASP form control checks for these but then you have difficulty with the Java Script //method of enabling/disabling the login button on the client side so I do the checks manually here and just use a single status //label for feedback - not quite as slick but the trade off is worth it. if (string.IsNullOrEmpty(TextBoxServerName.Text.Trim())) { LabelStatus.Text = "You must provide a Connection server name"; TextBoxServerName.Focus(); return; } if (string.IsNullOrEmpty(TextBoxName.Text.Trim())) { LabelStatus.Text = "You must provide a login name"; TextBoxName.Focus(); return; } if (string.IsNullOrEmpty(TextBoxPassword.Text.Trim())) { LabelStatus.Text = "You must provide a password"; TextBoxPassword.Focus(); return; } LabelStatus.Text = ""; try { currentConnectionServer = new ConnectionServerRest(new RestTransportFunctions(), TextBoxServerName.Text.Trim(), TextBoxName.Text.Trim(), TextBoxPassword.Text.Trim()); } catch { LabelStatus.Text = "Login failed, make sure the server name is valid, DNS is working properly and the user name and login are valid"; ButtonLogin.Enabled = true; return; } //if the class creation failed but the server login still didn't complete (this should really never happen, but just in case) if (currentConnectionServer.ServerName.Length == 0) { //login failed = give the user the chance to try again. LabelStatus.Text = "Login failed, make sure the server name is valid, DNS is working properly and the user name and login are valid"; ButtonLogin.Enabled = true; return; } //stuff the current connection server object into the session state where we can pull it out later. Then redirect to the select user //page which is where all the action takes place. Session["CurrentConnectionServer"] = currentConnectionServer; Response.Redirect("~/SelectUser.aspx"); }
private void _btnAceptar_Click(object sender, EventArgs e) { string username = TextBoxUsuario.Text.Trim(); string password = TextBoxPassword.Text.Trim(); bool usuarioNoValido = false; ErrorInicioSession error = ErrorInicioSession.SinError; if (ValidateUser(username, password)) { error = Sesion.Instancia.IniciarSesion(username, password); if (error == ErrorInicioSession.SinError) { RegistradorArchLocal.Instancia.NombreArchivo = Sesion.Instancia.EmpresaActual.Sigla; MessageMgr.Instance.SetConexion(Sesion.Instancia.Conexion); this.Hide(); DialogResult = System.Windows.Forms.DialogResult.OK; } else if (error == ErrorInicioSession.UsuarioNoValido || error == ErrorInicioSession.UsuarioNoValidoParaSisFalla) { usuarioNoValido = true; } else { MessageBox.Show(GetMensaje(error)); DialogResult = System.Windows.Forms.DialogResult.Cancel; } } else { usuarioNoValido = true; error = ErrorInicioSession.UsuarioNoValido; } if (usuarioNoValido) { if (error == ErrorInicioSession.UsuarioNoValido) { cndcLabelInfo.Text = "Usuario o contraseña incorrecto...(Intento " + NumIntentos + " de " + MaxIntentos + ")"; } else if (error == ErrorInicioSession.UsuarioNoValidoParaSisFalla) { cndcLabelInfo.Text = "Usuario no válido para SisFalla (Intento " + NumIntentos + " de " + MaxIntentos + ")"; } TextBoxPassword.Text = ""; TextBoxPassword.Focus(); NumIntentos++; if (NumIntentos > MaxIntentos) { MessageBox.Show("Tercer intento fallido, se cerrará la aplicación.");//MessageMgr.Instance.GetMessage("TERCER_INTENTO")); TextBoxUsuario.Enabled = false; TextBoxPassword.Enabled = false; DialogResult = System.Windows.Forms.DialogResult.Cancel; } } }
private void ButtonCancel_Click(object sender, RoutedEventArgs e) { TextBoxName.Clear(); TextBoxFamily.Clear(); TextBoxThirdName.Clear(); TextBoxAddress.Clear(); TextBoxNumber.Clear(); TextBoxLogin.Clear(); TextBoxPassword.Clear(); }
//Init public ResetPasswordWindow(Canvas parent, MainMenu mainMenu, ImagePanel parentPanel) { //Assign References mMainMenu = mainMenu; //Main Menu Window mResetWindow = new ImagePanel(parent, "ResetPasswordWindow"); mResetWindow.IsHidden = true; //Menu Header mWindowHeader = new Label(mResetWindow, "Header"); mWindowHeader.SetText(Strings.ResetPass.title); //Code Fields/Labels mCodeInputBackground = new ImagePanel(mResetWindow, "CodePanel"); mCodeInputLabel = new Label(mCodeInputBackground, "CodeLabel"); mCodeInputLabel.SetText(Strings.ResetPass.code); mCodeInputTextbox = new TextBox(mCodeInputBackground, "CodeField"); mCodeInputTextbox.SubmitPressed += Textbox_SubmitPressed; mCodeInputTextbox.Clicked += Textbox_Clicked; //Password Fields/Labels //Register Password Background mPasswordBackground = new ImagePanel(mResetWindow, "Password1Panel"); mPasswordLabel = new Label(mPasswordBackground, "Password1Label"); mPasswordLabel.SetText(Strings.ResetPass.password); mPasswordTextbox = new TextBoxPassword(mPasswordBackground, "Password1Field"); mPasswordTextbox.SubmitPressed += PasswordTextbox_SubmitPressed; //Confirm Password Fields/Labels mPasswordBackground2 = new ImagePanel(mResetWindow, "Password2Panel"); mPasswordLabel2 = new Label(mPasswordBackground2, "Password2Label"); mPasswordLabel2.SetText(Strings.ResetPass.password2); mPasswordTextbox2 = new TextBoxPassword(mPasswordBackground2, "Password2Field"); mPasswordTextbox2.SubmitPressed += PasswordTextbox2_SubmitPressed; //Login - Send Login Button mSubmitBtn = new Button(mResetWindow, "SubmitButton"); mSubmitBtn.SetText(Strings.ResetPass.submit); mSubmitBtn.Clicked += SubmitBtn_Clicked; //Login - Back Button mBackBtn = new Button(mResetWindow, "BackButton"); mBackBtn.SetText(Strings.ResetPass.back); mBackBtn.Clicked += BackBtn_Clicked; mResetWindow.LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString()); }
private void TextBoxPassword_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e) { String str = TextBoxPassword.Text.Trim(); if (str.Length > 18) { TextBoxPassword.Text = str.Remove(18); MessageBox.Show("用户名长度不能超过18个字符!", "操作提示"); TextBoxPassword.Select(str.Length, 0); } }
private void Clear() { TextBoxUserId.Clear(); TextBoxUserName.Clear(); TextBoxPassword.Clear(); TextBoxFunction.Clear(); ComboBoxAvailable.SelectedIndex = 0; PanelLeft.Enabled = false; _mode = -1; }
protected override void Page_Load(object sender, EventArgs e) { DataSet ds = null; Streamline.UserBusinessServices.MedicationLogin objMedicationLogin = new Streamline.UserBusinessServices.MedicationLogin(); try { clearBrowserCache(); if (!IsPostBack) { // Check if the Staff folder is created or not if (!System.IO.Directory.Exists(Server.MapPath("RDLC\\" + Context.User.Identity.Name) + "\\")) { System.IO.Directory.CreateDirectory(Server.MapPath("RDLC\\" + Context.User.Identity.Name) + "\\"); } RadioPassword.Checked = true; RadioPassword.Attributes.Add("onclick", "onRadioPasswordChange();"); RadioSignaturePad.Attributes.Add("onclick", "onRadioSignatureMouseTouchPadChange();"); RadioCanvasSignature.Attributes.Add("onclick", "onRadioSignatureMouseTouchPadChange();"); CheckBoxSignedPaperDocument.Attributes.Add("onclick", "onCheckBoxSignedPaperDocumentChange();"); HiddenFiledApplicationPath.Value = Server.MapPath("RDLC\\" + Context.User.Identity.Name); ButtonSign.Attributes.Add("onclick", "UpdateDocuments('', 'False');"); TextBoxPassword.Attributes.Add("onkeydown", CommonFunctions.ReturnJSForClickEvent(ButtonSign.UniqueID)); CheckBoxSignedPaperDocument.Attributes.Add("onkeydown", CommonFunctions.ReturnJSForClickEvent(ButtonSign.UniqueID)); RadioSignaturePad.Attributes.Add("onkeydown", CommonFunctions.ReturnJSForClickEvent(ButtonSign.UniqueID)); TextBoxPassword.Focus(); } } catch (Exception ex) { if (ex.Data["CustomExceptionInformation"] == null) { ex.Data["CustomExceptionInformation"] = ""; } else { ex.Data["CustomExceptionInformation"] = ""; } if (ex.Data["DatasetInfo"] == null) { ex.Data["DatasetInfo"] = null; } Streamline.BaseLayer.LogManager.LogException(ex, LogManager.LoggingCategory.General, LogManager.LoggingLevel.Error, this); } }
private void ShowNotAuthorisedDialog() { using (var dlg = new ErrorDialog(Messages.USER_NOT_AUTHORIZED) { WindowTitle = Messages.PERMISSION_DENIED }) { dlg.ShowDialog(this); } TextBoxPassword.Focus(); TextBoxPassword.SelectAll(); }
private void ShowNotAuthorisedDialog() { using (var dlg = new ThreeButtonDialog( new ThreeButtonDialog.Details( SystemIcons.Error, Messages.USER_NOT_AUTHORIZED, Messages.PERMISSION_DENIED))) { dlg.ShowDialog(this); } TextBoxPassword.Focus(); TextBoxPassword.SelectAll(); }
public override void InitializeLayout() { base.InitializeLayout(); pass = new TextBoxPassword(input_pass); pass.SetSize(260, 20); this.btn_login.Clicked += this.LoginButtonClickedHandler; this.input_user.SubmitPressed += this.OnFieldSubmit; this.pass.SubmitPressed += this.OnFieldSubmit; this.Position = new Point(Game.Resolution.Width / 2 - this.Window.Width / 2, Game.Resolution.Height / 2 - this.Window.Height / 2); this.Window.DisableResizing(); this.label_invalid.Hide(); this.input_user.Text = Configs.Username; this.pass.Text = Configs.Password; }
////////////////////////////////////////////////////////////////////////////////////////////////////////// // OTHER // ////////////////////////////////////////////////////////////////////////////////////////////////////////// #region Other private void RenewVirtualAccountName() { if (!CheckBoxUseVirtualAccount.IsChecked ?? false) { return; } TextBoxUsername.Text = "NT SERVICE\\" + TextBoxServiceName.Text; TextBoxUsername.IsReadOnly = true; TextBoxUsername.Foreground = Brushes.Gray; TextBoxUsername.BorderBrush = Brushes.LightGray; TextBoxPassword.Clear(); }
private void ButtonEdit_Click(object sender, EventArgs e) { TextBoxName.Enabled = true; TextBoxUsername.Enabled = true; TextBoxPassword.Enabled = true; ComboBoxRole.Enabled = true; ButtonNew.Enabled = false; ButtonEdit.Enabled = true; ButtonSave.Enabled = true; ButtonDelete.Enabled = false; TextBoxPassword.Clear(); _save = false; TextBoxName.Focus(); }
private void Login() { var online = true; if (TextBoxUsername.Text == "") { labelLogin.Text = "Username cannot be empty"; return; } if (TextBoxPassword.Text == "") { labelLogin.Text = "Password cannot be empty"; return; } try { _user = Database.SearchByUsername(TextBoxUsername.Text) ?? null; } catch (SqlException) { online = false; _user = new User { Name = TextBoxUsername.Text }; } if (_user == null) { labelLogin.Text = "user '" + TextBoxUsername.Text + "' not found"; TextBoxUsername.Clear(); TextBoxPassword.Clear(); TextBoxUsername.Focus(); return; } if (online && !_user.CheckPassword(TextBoxPassword.Text)) { labelLogin.Text = "wrong password :("; TextBoxPassword.Text = ""; TextBoxPassword.Focus(); return; } StartGame(online); }
private async void BtnLogin_Click(object sender, RoutedEventArgs e) { var email = TextBoxEmail.Text; if (string.IsNullOrEmpty(email) || !Regex.IsMatch(email, @".*@.*\..*")) { DisplayLoginError("Please enter an valid email address"); return; } if (string.IsNullOrEmpty(TextBoxPassword.Password)) { DisplayLoginError("Please enter a password"); return; } IsEnabled = false; var result = await HearthStatsAPI.LoginAsync(TextBoxEmail.Text, TextBoxPassword.Password); TextBoxPassword.Clear(); if (result.Success) { Core.MainWindow.EnableHearthStatsMenu(true); Core.MainWindow.FlyoutHearthStatsLogin.IsOpen = false; Core.MainWindow.MenuItemLogin.Visibility = Visibility.Collapsed; Core.MainWindow.MenuItemLogout.Visibility = Visibility.Visible; Core.MainWindow.SeparatorLogout.Visibility = Visibility.Visible; Core.MainWindow.MenuItemLogout.Header = $"LOGOUT ({HearthStatsAPI.LoggedInAs})"; var dialogResult = await Core.MainWindow.ShowMessageAsync("Sync now?", "Do you want to sync with HearthStats now?", MessageDialogStyle.AffirmativeAndNegative, new MessageDialogs.Settings { AffirmativeButtonText = "sync now", NegativeButtonText = "later" }); if (dialogResult == MessageDialogResult.Affirmative) { HearthStatsManager.SyncAsync(); } } else { DisplayLoginError(result.Message); } }
private void ImagePassword_PreviewMouseDown(object sender, MouseButtonEventArgs e) { if (padlock == 0) { PasswordBoxPassword.Visibility = System.Windows.Visibility.Collapsed; TextBoxPassword.Visibility = System.Windows.Visibility.Visible; TextBoxPassword.Text = PasswordBoxPassword.Password; TextBoxPassword.Focus(); TextBoxPassword.SelectionStart = TextBoxPassword.Text.Length; padlock = 1; if (kolor == 1) { imagePassword.Source = new BitmapImage(new Uri(@"/Images/GrafikiPanel/unlockAqua.png", UriKind.Relative)); } else if (kolor == 0) { imagePassword.Source = new BitmapImage(new Uri(@"/Images/GrafikiPanel/unlock.png", UriKind.Relative)); } } else if (padlock == 1) { PasswordBoxPassword.Visibility = System.Windows.Visibility.Visible; TextBoxPassword.Visibility = System.Windows.Visibility.Collapsed; PasswordBoxPassword.Password = TextBoxPassword.Text; SetSelection(PasswordBoxPassword, (TextBoxPassword.Text).Length, 0); PasswordBoxPassword.Focus(); SetSelection(PasswordBoxPassword, (TextBoxPassword.Text).Length, 0); // PasswordBoxPassword. = PasswordBoxPassword.Password.Length; // SetSelection(PasswordBoxPassword, 2, 0); padlock = 0; if (kolor == 1) { imagePassword.Source = new BitmapImage(new Uri(@"/Images/GrafikiPanel/lockAqua.png", UriKind.Relative)); } else if (kolor == 0) { imagePassword.Source = new BitmapImage(new Uri(@"/Images/GrafikiPanel/lock.png", UriKind.Relative)); } } }