private void UserID_ComboBox_TextChanged(object sender, EventArgs e) { bool isEx = false; foreach (var item in userConfigs) { if (UserID_ComboBox.Text == item.UserID) { UserConfig = item; if (UserConfig.RememberPassword) { Password_TextBox.Text = new Tool_Folder.DesHelper().Decrypt(UserConfig.Password); } isEx = true; break; } } if (!isEx) { Password_TextBox.Clear(); RememberPassword_CheckBox.Checked = false; UserConfig = new ProtoKey.UserConfig { UserID = UserID_ComboBox.Text }; } }
/// <summary> /// Constructor /// </summary> public LoginWindow() { InitializeComponent(); // Give textbox focus Password_TextBox.Focus(); // Create the new data vault interface _dataVaultInterface = new DataVaultInterface(); }
private void Password_TextBox_GotFocus(object sender, RoutedEventArgs e) { if (animationCheck1) { var fade = new DoubleAnimation { To = 1.0, Duration = new Duration(new TimeSpan(0, 0, 1)) }; Password_TextBox.BeginAnimation(OpacityProperty, fade); animationCheck1 = false; } }
private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(Username_TextBox.Text) || String.IsNullOrEmpty(Password_TextBox.Text) || String.IsNullOrEmpty(FirstName_TextBox.Text) || String.IsNullOrEmpty(LastName_TextBox.Text)) { MessageBox.Show("Не всі обов'язкові параметри вказані", "Помилка", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (Password_TextBox.Text != Password_Repeat_textbox.Text) { MessageBox.Show("Паролі не співпадають", "Помилка", MessageBoxButtons.OK, MessageBoxIcon.Error); Password_Repeat_textbox.Clear(); Password_TextBox.Clear(); } else { DataContext db = new DataContext(@"Data Source = (LocalDB)\MSSQLLocalDB;AttachDbFilename=" + @Environment.CurrentDirectory + "\\CourseWork.mdf" + @";Integrated Security = True"); Table <User> user = db.GetTable <User>(); User newUser = new User { Username = Username_TextBox.Text, Control_Level = 1, Password = Password_TextBox.Text, First_Name = FirstName_TextBox.Text, Last_Name = LastName_TextBox.Text, age = Convert.ToInt32(Date_of_Birth_TextBox.Text) }; user.InsertOnSubmit(newUser); db.SubmitChanges(); MessageBox.Show("Користувач успішно зареєстрований", "Інформація", MessageBoxButtons.OK, MessageBoxIcon.Information); Close(); //SqlConnection SqlCon = new SqlConnection(@"Data Source = (LocalDB)\MSSQLLocalDB;AttachDbFilename=" + @Environment.CurrentDirectory + "\\CourseWork.mdf" + @";Integrated Security = True"); //SqlCon.Open(); //SqlCommand addcom = new SqlCommand("INSERT INTO [Users] ([Username], [][Password],[First_Name],[Last_Name],[Age])VALUES(@username,@passsword,@first_name,@last_name,@Age)", SqlCon); //addcom.Parameters.AddWithValue("username", Username_TextBox.Text); //addcom.Parameters.AddWithValue("passsword", Password_TextBox.Text); //addcom.Parameters.AddWithValue("first_name", FirstName_TextBox.Text); //addcom.Parameters.AddWithValue("last_name", LastName_TextBox.Text); //addcom.Parameters.AddWithValue("Age", Convert.ToInt32(Date_of_Birth_TextBox.Text)); //addcom.ExecuteNonQuery(); //SqlCon.Close(); } }
private void Password_TextBox_PasswordChanged(object sender, RoutedEventArgs e) { Password_TextBox.BeginAnimation(OpacityProperty, trash); if (animationCheck && Password_TextBox.Password.Length < 4) { Guid_Label.Content = "비밀번호는 4자 이상으로 해주세요"; animationCheck = false; } if (!animationCheck && Password_TextBox.Password.Length >= 4) { Password_TextBox_Check.BeginAnimation(OpacityProperty, fade); Guid_Label.Content = "비밀번호를 아래에 다시 적어주세요"; animationCheck = true; } }
private void Window_Loaded(object sender, RoutedEventArgs e) { #if DEBUG Topmost = false; #else Hook.Start(); using var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Policies\System"); key.SetValue("DisableTaskMgr", "1"); key.Close(); #endif Picture.Delete(); Profile_Image.ImageSource = ImageSourceFromBitmap(Properties.Resources.Profile_Default); Battery_Image.Source = ImageSourceFromBitmap(Properties.Resources.Battery); var red = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)); var yellow = new SolidColorBrush(Color.FromArgb(255, 255, 255, 0)); var green = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0)); ThreadPool.QueueUserWorkItem((x) => { while (timerT) { Dispatcher.Invoke(() => { Clock_Label_H.Content = DateTime.Now.ToString("hh"); Clock_Label_M.Content = DateTime.Now.ToString("mm"); Clock_Label_C.Visibility = Clock_Label_C.Visibility == Visibility.Visible ? Visibility.Hidden : Visibility.Visible; }); Thread.Sleep(500); } }); ThreadPool.QueueUserWorkItem((x) => { while (batteryT) { var battery = GetBatteryPercentage(); Dispatcher.Invoke(() => { Battery_Gage.Fill = battery <= 33 ? red : battery <= 66 ? yellow : green; Battery_Percentage.Content = $"{battery}%"; Battery_Gage.Width = battery * 0.73; }); Thread.Sleep(60000); } }); Password_TextBox.Focus(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { #if !DEBUG if (string.IsNullOrEmpty(Settings.Default.Password)) { new TermsOfUseWindow().ShowDialog(); } #endif Password_TextBox.Focus(); Guid_Label.BeginAnimation(OpacityProperty, fade); Guid_Label.Content = "저는 루시드 드림의 사용을 도와주는\n도우미, 루시입니다."; var sw = new Stopwatch(); sw.Start(); for (; ;) { System.Windows.Forms.Application.DoEvents(); Thread.Sleep(1); sw.Stop(); if (sw.Elapsed.TotalSeconds >= 2) { sw.Restart(); break; } sw.Start(); } Guid_Label.BeginAnimation(OpacityProperty, fade); Guid_Label.Content = "제가 지시하는 대로 따라주세요."; for (; ;) { System.Windows.Forms.Application.DoEvents(); Thread.Sleep(1); sw.Stop(); if (sw.Elapsed.TotalSeconds >= 2) { break; } sw.Start(); } Guid_Label.BeginAnimation(OpacityProperty, trash); Password_TextBox.BeginAnimation(OpacityProperty, fade); Guid_Label.Content = "비밀번호를 입력하세요"; }
public void login() { LoggedInStatus_Label.set_Text("trying to login to: {0}".format(MediaWikiUrl_TextBox.get_Text())) .textColor(Color.Black); var username = UserName_TextBox.get_Text(); var password = Password_TextBox.get_Text(); WikiApi.login(username, password).isFalse(); if (WikiApi.loggedIn()) { LoggedInStatus_Label.set_Text("Logged in as user: {0}".format(username)) .textColor(Color.Green); } else { LoggedInStatus_Label.set_Text("Login failed for user {0}".format(username)) .textColor(Color.Red); } SetWikiApi(WikiApi); }
private bool IsLogin() { string userID = UserID_TextBox.Text; if (string.IsNullOrWhiteSpace(userID)) { MessageBoxHelper.ShowErrorMessage("Tên đăng nhập không được trống!"); UserID_TextBox.Focus(); return(false); } if (string.IsNullOrWhiteSpace(Password_TextBox.Text)) { MessageBoxHelper.ShowErrorMessage("Mật khẩu không được trống!"); Password_TextBox.Focus(); return(false); } using (UserController controller = new UserController()) { Users user = controller.GetUsers()?.Find(o => o.UserID.ToUpper() == userID.ToUpper()); if (user != null && ClientCommon.IsComparePass(Password_TextBox.Text, user.Password)) { SetUserInfo(user); UserInfo.Companies = controller.GetUserCompany(UserInfo.UserID); return(true); } else { LoginCount++; MessageBoxHelper.ShowErrorMessage("Tên đăng nhập hoặc mật khẩu không đúng!"); UserID_TextBox.Focus(); return(false); } } }
static void Main() { // Red text is for printing errors void RedMessage(string message) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine(message); Console.ForegroundColor = ConsoleColor.White; } // Green text is for printing successes void GreenMessage(string message) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(message); Console.ForegroundColor = ConsoleColor.White; } RedMessage("Red Message Initialized"); GreenMessage("Green Message Initialized"); string password = "******"; string username = "******"; IWebDriver driver = new ChromeDriver(); IWebElement UserName_TextBox; IWebElement Password_TextBox; IWebElement No_Save_Password; IWebElement GrandExchangeButton; GreenMessage("Initial_Setup Variables Successfully Initialized"); void Initial_Setup() { try { driver.Navigate().GoToUrl("http://www.runescape.com/companion/comapp.ws"); GreenMessage("Navigation Complete"); Thread.Sleep(10000); GreenMessage("Wait for page to load"); driver.SwitchTo().Frame(0); UserName_TextBox = driver.FindElement(By.Name("username")); UserName_TextBox.Click(); UserName_TextBox.SendKeys(username); GreenMessage("Found Username Text Box"); driver.SwitchTo().DefaultContent(); driver.SwitchTo().Frame(0); Password_TextBox = driver.FindElement(By.Name("password")); Password_TextBox.Click(); Password_TextBox.SendKeys(password); Password_TextBox.Submit(); GreenMessage("Found Password Text Box"); driver.SwitchTo().DefaultContent(); driver.SwitchTo().Frame(0); GreenMessage("Wait for RS Authenticator"); Thread.Sleep(20000); No_Save_Password = driver.FindElement(By.CssSelector("#modal > div > div > div > div.pill-wrap.double > a:nth-child(1)")); No_Save_Password.Click(); GreenMessage("Don't save password clicked"); Thread.Sleep(5000); GrandExchangeButton = driver.FindElement(By.CssSelector("#main-menu > div > nav > ul > li.grand-exchange > a")); GrandExchangeButton.Click(); GreenMessage("Found GE Button on Main Menu"); Thread.Sleep(5000); } catch (NoSuchElementException) { RedMessage("Initial Setup Failed"); } } Initial_Setup(); IWebElement Buy; IWebElement New_SearchBar; IWebElement New_MagicLogsButton; GreenMessage("Set_Price Variables Successfully Initialized"); void Set_Price() { try { Buy = driver.FindElement(By.CssSelector("body > div.sliding-wrapper > div.ng-scope > section > div > ul > li:nth-child(1) > div > div > div.details.with-buttons > div > a:nth-child(1)")); Buy.Click(); New_SearchBar = driver.FindElement(By.XPath("//*[@id=\"search\"]")); New_SearchBar.Click(); New_SearchBar.SendKeys("Magic"); Thread.Sleep(2000); New_SearchBar.SendKeys(" Logs"); New_MagicLogsButton = driver.FindElement(By.CssSelector("body > div.sliding-wrapper > div.ng-scope > section > div.content.push-top-double.push-bottom-tiny.ng-scope > ul > li > a > div.details > span")); New_MagicLogsButton.Click(); } catch (NoSuchElementException) { RedMessage("Set_Price Failed"); } } /* * ------------------- * MAIN LOOP -- MAIN LOOP * MAIN LOOP -- MAIN LOOP * MAIN LOOP -- MAIN LOOP * ------------------- */ /* * ------------------- * MAIN LOOP -- MAIN LOOP * MAIN LOOP -- MAIN LOOP * MAIN LOOP -- MAIN LOOP * ------------------- */ }
public ascx_MediaWiki_ConfigAndLogin buildGui(O2MediaWikiAPI wikiApi, Action <O2MediaWikiAPI> setWikiApi) { WikiApi = wikiApi; SetWikiApi = setWikiApi; var controls = this.add_1x1("Config", "Login Details", false); var config_Panel = controls[0]; var loginDetails_Panel = controls[1]; //config_Panel TargetMediaWiki_ComboBox = config_Panel.add_Label("Target MediaWiki website", 12, 10) .append_Control <ComboBox>() .dropDownList() .onSelection <string>(loadMediaWikiDetails); MediaWikiUrl_TextBox = config_Panel.add_Label("MediaWiki Url: ", 40, 10) .append_TextBox(""); MediaWiki_API_php_TextBox = config_Panel.add_Label("MediaWiki api.php: ", 60, 10) .append_TextBox(""); MediaWiki_Index_php_TextBox = config_Panel.add_Label("MediaWiki index.php: ", 80, 10) .append_TextBox(""); MediaWikiUrlCheck_Label = config_Panel.add_Link("Check MediaWiki Urls", 110, 128, checkMediaWikiUrls) .append_Label("") .autoSize(); MediaWikiUrl_TextBox.align_Right(config_Panel).leftAdd(2).widthAdd(-7); MediaWiki_API_php_TextBox.align_Right(config_Panel).widthAdd(-5); MediaWiki_Index_php_TextBox.align_Right(config_Panel).widthAdd(-5); //loginDetails_Panel loginDetails_Panel.add_Label("A) Login using local config file:", 20, 10); SecretsFile_TextBox = loginDetails_Panel.add_TextBox(40, 102, false) .set_Text(defaultSecretsFolder.pathCombine(defaultSecretsFile)) .onEnter(loadCredentials); Credential_ComboBox = loginDetails_Panel.add_ComboBox(60, 102).width(220).sorted(); Credential_ComboBox.onSelection <ICredential>(loadCredentialDetails); loginDetails_Panel.add_Label("B) Login using username & password: "******"Username:"******""); Password_TextBox = loginDetails_Panel.add_Label("Password: "******"") .isPasswordField(); SecretsFile_TextBox.align_Right(loginDetails_Panel).widthAdd(-40); SecretsFile_TextBox.append_Control <Button>() .set_Text("...") .width(30) .heightAdd(-2) .anchor_TopRight() .onClick(() => { var file = this.askUserForFileToOpen(defaultSecretsFolder, "Xml Files | *.xml"); if (file.valid()) { SecretsFile_TextBox.set_Text(file); loadCredentials(file); } });; UserName_TextBox.width(200); Password_TextBox.width(200); LoggedInStatus_Label = Password_TextBox.append_Link("Login", login) .topAdd(5) .append_Label("") .autoSize(); loadCredentials(SecretsFile_TextBox.get_Text()); loadDefaultMediaWikiEngines(); return(this); }
public void loadCredentialDetails(ICredential credential) { UserName_TextBox.set_Text(credential.username()); Password_TextBox.set_Text(credential.password()); }
private void SignUp_btn_Click(object sender, EventArgs e) { try { if (ID_textbox.Text == string.Empty) { MessageBox.Show("Empty ID Box", "Empty detected", MessageBoxButtons.OK, MessageBoxIcon.Error); ID_textbox.Focus(); } //check the signup name box if it's empty if (Name_TextBox.Text == string.Empty) { MessageBox.Show("Empty Name Box", "Empty detected", MessageBoxButtons.OK, MessageBoxIcon.Error); Name_TextBox.Focus(); }//check te signup password box if it's empty else if (Password_TextBox.Text == string.Empty) { MessageBox.Show("Empty Password Box", "Empty detected", MessageBoxButtons.OK, MessageBoxIcon.Error); Password_TextBox.Focus(); } else if (Email_textBox.Text == string.Empty) {//Check email box MessageBox.Show("Please enter your email", "Email", MessageBoxButtons.OK, MessageBoxIcon.Information); Email_textBox.Focus(); } //check the digit of password else if (Password_TextBox.Text.Length < 8) { MessageBox.Show("Hint: short password , password should be 8 digit or more ", "short password", MessageBoxButtons.OK, MessageBoxIcon.Information); Password_TextBox.Focus(); Password_TextBox.SelectAll(); } else if (ID_textbox.Text.Length < 9) { MessageBox.Show("Hint: short ID , ID should 9 digit or more ", "Short user ID ", MessageBoxButtons.OK, MessageBoxIcon.Information); ID_textbox.Focus(); ID_textbox.SelectAll(); } else { //Enter new data iin database OnlineBankingSystemDBDataset.UsersRow row; row = onlineBankingSystemDBDataset1.Users.NewUsersRow(); row.User_ID = int.Parse(ID_textbox.Text); User_ID = int.Parse(ID_textbox.Text); U_Name = Name_TextBox.Text; row.Name = Name_TextBox.Text; row.Email = Email_textBox.Text; row.Password = Password_TextBox.Text; onlineBankingSystemDBDataset1.Users.Rows.Add(row); this.usersTableAdapter.Update(onlineBankingSystemDBDataset1.Users); if (usersTableAdapter.Check_data_Entry(Name_TextBox.Text) != null) { MessageBox.Show("Account created", "Account Manager", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Cannot enter"); } } } catch (Exception data_signup) { MessageBox.Show(data_signup.Message, "Exception Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void Reset_Button_Click(object sender, RoutedEventArgs e) { Username_TextBox.Text = ""; Password_TextBox.Clear(); }