private void PasteCharInPassword(int position, char symbol) { string string1 = CurrentPassword.Insert(position, symbol.ToString()); string string2 = string1.Remove(position + 1, 1); CurrentPassword = string2; }
internal void ChangePassword() { //Populate the Excel sheet GlobalDefinitions.ExcelLib.PopulateInCollections(Global.Base.ExcelPath, "SignIn"); GlobalDefinitions.wait(60); Actions builder = new Actions(Global.GlobalDefinitions.driver); builder.MoveToElement(UsernameNavigation).Build().Perform(); UsernameNavigation.Click(); GlobalDefinitions.wait(60); ChangePasswordMenu.Click(); CurrentPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "CurrentPassword")); NewPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "NewPassword")); ConfirmPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "ConfirmPassword")); GlobalDefinitions.wait(60); Savebutton.Click(); }
private void IncrementPassword(int position) { if (CurrentPassword[position].Equals('9')) { PasteCharInPassword(position, 'a'); return; } if (CurrentPassword[position].Equals('z')) { PasteCharInPassword(position, 'A'); return; } if (CurrentPassword[position].Equals('Z')) { if (position == 0) { string str = CurrentPassword.Insert(position, '0'.ToString()); CurrentPassword = str; PasteCharInPassword(position + 1, '0'); return; } else { PasteCharInPassword(position, '0'); IncrementPassword(position - 1); } } else { char symb = CurrentPassword[position]; symb++; PasteCharInPassword(position, symb); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Utilities.SetNoCache(Response); CurrentPassword.Focus(); } }
/// <summary> /// Commit the content and exits out of edit mode /// </summary> public void Save() { //Make sure the current password is correct //TODO: This will come from the real back-end store of this user password // or via the web server to confirm it var storePassword = "******"; //Confirm current password is match //NOTE: Typically this isn't done here, it's done on the server if (storePassword != CurrentPassword.Unsecure()) { //Let us know IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Wrong password", Message = "The current password is invalid", }); return; } //Now check the new and confirm password match //NOTE: Typically this isn't done here, it's done on the server if (NewPassword.Unsecure() != ConfirmPassword.Unsecure()) { //Let us know IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Password mismatch", Message = "The new and confirm password do not match", }); return; } //Check we actually have a password if (NewPassword.Unsecure().Length == 0) { //Let us know IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Password too short", Message = "You must enter a password!", }); return; } //Set the edited password to the current value CurrentPassword = new SecureString(); foreach (var c in NewPassword.Unsecure().ToCharArray()) { CurrentPassword.AppendChar(c); } Editing = false; }
private void ClearForm() { CurrentPassword.Dispose(); CurrentPassword = new SecureString(); NewPassword.Dispose(); NewPassword = new SecureString(); ConfirmPassword.Dispose(); ConfirmPassword = new SecureString(); }
internal void AddNewPassword() { CurrentPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "CurrentPassword")); NewPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "NewPassword")); ConfirmPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "ConfirmPassword")); Thread.Sleep(1000); SaveChanges.Click(); }
private void ClearPage() { CurrentPassword.Dispose(); CurrentPassword = new SecureString(); NewPassword.Dispose(); NewPassword = new SecureString(); ConfirmPassword.Dispose(); ConfirmPassword = new SecureString(); SetMessage(INITIAL, INITIAL_COLOR); }
public void UpdatePersonalInformation(string strFirstName, string strCurrentPassword) { PersonalInformationButton.Click(); wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(100)); FirstName.Clear(); FirstName.SendKeys(strFirstName); CurrentPassword.SendKeys(strCurrentPassword); SaveButton.Click(); }
public void ChangePassword_Should_Update_Password() { const string CurrentPassword = "******"; _user.Password = CurrentPassword.Hash(); _user.ChangePassword(CurrentPassword, "foobar"); Assert.NotEqual(_user.Password, CurrentPassword); }
void ChangePassword(object sender, EventArgs args) { mainViewModel = MainViewModel.GetInstance(); employee = mainViewModel.Employee; CurrentPassword.Text = string.Empty; NewPassword.Text = string.Empty; ConfirmPassword.Text = string.Empty; PasswordModal.IsVisible = true; CurrentPassword.Focus(); }
public void ChangePassword_Should_Update_Email() { const string CurrentPassword = "******"; DateTime currentLastActivity = _user.LastActivityAt; _user.Password = CurrentPassword.Hash(); _user.ChangePassword(CurrentPassword, "foobar"); Assert.NotEqual(_user.LastActivityAt, currentLastActivity); }
private void DetectInputLogin() { string CurrPasswd = CurrentPassword.Password; string NewPasswd = Password.Password; string PasswdV = PasswordV.Password; if (string.IsNullOrEmpty(CurrPasswd) || string.IsNullOrEmpty(NewPasswd) || string.IsNullOrEmpty(PasswdV)) { if (string.IsNullOrEmpty(CurrPasswd)) { CurrentPassword.Focus(FocusState.Keyboard); } else if (string.IsNullOrEmpty(NewPasswd)) { Password.Focus(FocusState.Keyboard); } else if (string.IsNullOrEmpty(PasswdV)) { PasswordV.Focus(FocusState.Keyboard); } } else if (NewPasswd != PasswdV) { StringResources stx = StringResources.Load("Error"); ServerMessage.Text = stx.Str("PasswordMismatch"); Password.Focus(FocusState.Keyboard); } else { ServerMessage.Text = ""; IsPrimaryButtonEnabled = IsSecondaryButtonEnabled = CurrentPassword.IsEnabled = Password.IsEnabled = PasswordV.IsEnabled = false ; this.Focus(FocusState.Pointer); IndicateLoad(); RuntimeCache RCache = new RuntimeCache() { EN_UI_Thead = true }; RCache.POST( Shared.ShRequest.Server , Shared.ShRequest.ChangePassword(CurrPasswd, NewPasswd) , RequestComplete, RequestFailed, false); } }
//Enter change password credintals public void EnterChangePasswordCredintals(string oldPassword, string newPassword, string confirmPassword) { //Enter Current Password CurrentPassword.SendKeys(oldPassword); //Enter New Password NewPassword.SendKeys(newPassword); //Enter Confirm Password ConfirmPassword.SendKeys(confirmPassword); //Click on Save Button SaveChangedPassword.Click(); }
private void RequestComplete(DRequestCompletedEventArgs e, string QueryId) { IndicateIdle(); try { JsonStatus.Parse(e.ResponseString); Canceled = false; Hide(); } catch (Exception ex) { ErrorMessage(ex.Message); CurrentPassword.Focus(FocusState.Keyboard); } }
public void Trim() { if (!string.IsNullOrEmpty(CurrentPassword)) { CurrentPassword = CurrentPassword.Trim(); } if (!string.IsNullOrEmpty(NewPassword)) { NewPassword = NewPassword.Trim(); } if (!string.IsNullOrEmpty(ConfirmNewPassword)) { ConfirmNewPassword = ConfirmNewPassword.Trim(); } }
public void Save() { // TODO: Current password check from real back-end var storedPassword = "******"; // For test, placeholder of call to back-end if (storedPassword != CurrentPassword.Unsecure()) { IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Wrong password", Message = "The current password is invalid" }); return; } if (NewPassword.Unsecure() != ConfirmPassword.Unsecure()) { IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Password mismatch", Message = "The new and the old password do not match." }); return; } if (NewPassword.Unsecure().Length == 0) { IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Password too short", Message = "You must enter a password!" }); return; } CurrentPassword = new SecureString(); foreach (var c in NewPassword.Unsecure().ToCharArray()) { CurrentPassword.AppendChar(c); } Editing = false; }
/// <summary> /// Tjekker om passwords er ens og ikke er tomme /// </summary> /// <returns>bool</returns> private bool PasswordChecker() { if (NewPassword != null && NewPasswordCheck != null && CurrentPassword != null) { if (NewPassword.Equals(NewPasswordCheck) && CurrentPassword.Equals(MC.CurrentUser.Password)) { MC.CurrentUser.Password = NewPassword; return(true); } return(false); } else { return(true); } }
/// <summary> /// Commits the content and exits out of edit mode /// </summary> public void Save() { // TODO: Save content //double check password for integrity // TODO: This will come from the backend store var storedPassword = "******"; //NOTE: typically done serverside not client side if (storedPassword != CurrentPassword.Unsecure()) { IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Wrong Password", Message = "The current password is invalid", }); } //check new and confirm password match if (NewPassword.Unsecure() != ConfirmPassword.Unsecure()) { IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Password Mismatch", Message = "The new and confirm password do not match", }); } //check new and confirm password match if (NewPassword.Unsecure().Length == 0) { IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Password Too Short", Message = "You must enter a password!", }); } //set the edited password to the current value CurrentPassword = new SecureString(); foreach (var c in NewPassword.Unsecure().ToCharArray()) { CurrentPassword.AppendChar(c); } Editing = false; }
private void Button_Click(object sender, RoutedEventArgs e) { ChangePasswords w = new ChangePasswords(); SqlConnection con1 = new SqlConnection(PublicVar.ConnectionString); con1.Open(); SqlCommand myCommand = new SqlCommand("Select (Password) from LockTable where Username = '******'", con1); object result = myCommand.ExecuteScalar(); string OldPassword = Regex.Replace(Convert.ToString(result), @"\s+", ""); if (PasswordID.Text.Trim() != "" && PasswordID2.Text.Trim() != "" && CurrentPassword.Text.Trim() != "") { if (CurrentPassword.Text.Trim() == OldPassword) // true { if (PasswordID.Text.Trim() == PasswordID2.Text.Trim()) // true { string newpassword = PasswordID.Text.Trim(); SqlCommand Commandcmdsz = new SqlCommand("update LockTable set Password = '******' Where Username = '******'", con1); Commandcmdsz.ExecuteScalar(); MessageBox.Show("رمز عبور شما با موفقیت تغیر کرد", "اطلاعات اکانت"); con1.Close(); Close(); } else { MessageBox.Show("رمز های عبور یکسان نیستند"); PasswordID.Focus(); } } else { MessageBox.Show("رمز عبور قبلی شما درست نیست", "اطلاعات اکانت"); CurrentPassword.Focus(); } } else { MessageBox.Show("قسمت های خالی را پر کنید"); PasswordID.Focus(); PasswordID2.BorderBrush = Brushes.Red; PasswordID.BorderBrush = Brushes.Red; } con1.Close(); }
public async Task SaveAsync() { var hashedNewPassword = NewPassword.HashValue(); var hashedRepeatPassword = RepeatPassword.HashValue(); if (!hashedNewPassword.Equals(hashedRepeatPassword)) { IMainWindowViewModel.MessageQueue.Enqueue("The new password don't much with the repeated one.", "OK", (obj) => { }, new object(), false, true, TimeSpan.FromSeconds(6)); return; } var result = await IMainWindowViewModel.User.TryChangePasswordAsync(IMainWindowViewModel.User.Email, CurrentPassword, hashedNewPassword); if (result) { IMainWindowViewModel.MessageQueue.Enqueue("Password has changed successfully.", "OK", (obj) => { }, new object(), false, true, TimeSpan.FromSeconds(6)); } else { IMainWindowViewModel.MessageQueue.Enqueue("The old password do not much to one of the records in the server.", "OK", (obj) => { }, new object(), false, true, TimeSpan.FromSeconds(6)); } CurrentPassword.Clear(); NewPassword.Clear(); RepeatPassword.Clear(); }
public async Task <IActionResult> OnPostSaveEditAsync() { ApplicationUser.EmailAddress = EmailAddress; ApplicationUser.FirstName = FirstName; ApplicationUser.LastName = LastName; HashString Hash = new HashString(); CurrentPassword = Hash.ComputeSha256Hash(CurrentPassword); if (!CurrentPassword.Equals(Password)) { CurrentPasswordErrorMessage = "Current password mismatch!!"; return(Page()); } ApplicationUser.Password = Hash.ComputeSha256Hash(Password); _context.Attach(ApplicationUser).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ApplicationUserExists(ApplicationUser.ID)) { return(NotFound()); } else { throw; } } EmailAddress = ""; FirstName = ""; LastName = ""; Password = ""; return(RedirectToPage("/AppUser/Profile", new { Id = ApplicationUser.ID })); }
public void Save() { var storedPassword = "******"; if (storedPassword != CurrentPassword.Unsecure()) { IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Wrong password", Message = "The current password is invalid", }); return; } if (NewPassword.Unsecure() != ConfirmPassword.Unsecure()) { IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Password mismatch", Message = "The new and confirm password do not match", }); return; } if (NewPassword.Unsecure().Length == 0) { IoC.UI.ShowMessage(new MessageBoxDialogViewModel { Title = "Password too short", Message = "You must enter a password!", }); return; } CurrentPassword = new SecureString(); foreach (var c in NewPassword.Unsecure().ToCharArray()) { CurrentPassword.AppendChar(c); } Editing = false; }
//Change the password internal void ChangePassword() { Extension.WaitForElementDisplayed(GlobalDefinitions.Driver, By.XPath("//span[@class='item ui dropdown link '][contains(text(),'Hi')]"), 8); //Move to dropdown list and click Change password Actions action = new Actions(Driver); action.MoveToElement(ChangePasswordDropDownLink).Build().Perform(); Extension.WaitForElementDisplayed(GlobalDefinitions.Driver, By.XPath("//a[text()='Change Password']"), 5); action.MoveToElement(ChangePasswordLink).Click().Build().Perform(); //Enter te current, new and confirm password and click save CurrentPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Password")); NewPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "New Password")); ConfirmPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Confirm Password")); SaveChangedPassword.Click(); Base.Image = SaveScreenShotClass.SaveScreenshot(Driver, "Report"); //Validate message Extension.MessageValidation("Password Changed Successfully"); }
/// <summary> /// Commits the content and exits out of edit mode /// </summary> private void Save() { // Store the result of a commit call var result = default(bool); if (CurrentPassword.UnSecure() != UserPassword.UnSecure()) { ErrorMessage = "Hasło nie poprawne"; return; } if (NewPassword.UnSecure() != ConfirmPassword.UnSecure()) { ErrorMessage = "Hasła do siebie nie pasują"; return; } RunCommandAsync(() => Updating, async() => { // While updating, come out of edit mode Editing = false; // Get new value to update CommitAction = IoC.Settings.UpdateEmployeeDetailAsync; // Try and do the work result = CommitAction == null || await CommitAction(); }).ContinueWith(t => { // If we succeeded // Nothing to do // If we fail if (!result) { // Go back into edit mode Editing = true; } }); }
//Change Password public void ChangePasswordOnProfile(string oldPassword, string newPassword, string confirmPassword) { Actions actions = new Actions(driver); driver.WaitForElementIsVisible(UserNameDropDown); actions.MoveToElement(UserNameDropDown).Build().Perform(); //Click on ChangePassword driver.WaitForElementIsVisible(ChangePassword); ChangePassword.Click(); //Enter Current Password CurrentPassword.SendKeys(oldPassword); //Enter New Password NewPassword.SendKeys(newPassword); //Enter Confirm Password ConfirmPassword.SendKeys(confirmPassword); //Click on Save Button SaveChangedPassword.Click(); }
public void EnterDetails(Table table) { foreach (var row in table.Rows) { switch (row[0].ToLower()) { case "currentpassword": CurrentPassword.SendKeys(row[1]); break; case "newpassword": NewPassword.SendKeys(row[1]); break; case "confirmnewpassword": ConfirmNewPassword.SendKeys(row[1]); break; default: throw new Exception(string.Format("Field {0} not defined", row[0])); } } }
//Validate the password is changed internal void ValidateChangedPassword() { try { SignIn loginobj = new SignIn(); loginobj.SignOutSteps(); //Click on Sign In button SignIntab.Click(); //Enter UserName Email.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Username")); //Enter the changed Password Password.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "New Password")); //Click Login Button LoginBtn.Click(); Thread.Sleep(5000); GlobalDefinitions.ValidateBoolean(ChangePasswordDropDownLink.Displayed, "Password Changed"); } catch (Exception e) { Base.test.Log(LogStatus.Fail, "Caught Exception For Change Password", e.Message); } //Resetting the password ChangePasswordDropDownLink.Click(); Extension.WaitForElementDisplayed(GlobalDefinitions.Driver, By.XPath("//a[text()='Change Password']"), 5); ChangePasswordLink.Click(); CurrentPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "New Password")); NewPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Password")); ConfirmPassword.SendKeys(GlobalDefinitions.ExcelLib.ReadData(2, "Password")); SaveChangedPassword.Click(); }
private void UpdateCurrentPasswordAwareTextBlock() { CurrentPasswordAwareTextBlockVisibility = CurrentPassword.Equals(CurrentUser.Password) ? Visibility.Collapsed : Visibility.Visible; }
public void FillCurrentPassword(string currentpass) { CurrentPassword.SendKeys(currentpass); }