private void ChangeButton_Click(object sender, EventArgs e) { if ((username != "giaovu" && CurrPass.Text.Length < 8) || CurrPass.Text.Length > 16) { NotiLabel.Text = "Current password is not correct."; } else if (NewPass.Text.Length < 8) { NotiLabel.Text = "Password must contain at least 8 characters."; } else if (NewPass.Text.Length > 16) { NotiLabel.Text = "Password must contain at most 16 characters."; } else if (NewPass.Text != ConfirmPass.Text) { NotiLabel.Text = "Confirm new password does not match."; } else if (NewPass.Text == CurrPass.Text) { NotiLabel.Text = "New password must be different from the current one."; } else { StudentServices services = new StudentServices(); NotiLabel.Text = services.ChangePassword(username, CurrPass.Text, NewPass.Text); } CurrPass.Clear(); NewPass.Clear(); ConfirmPass.Clear(); }
private void ClearProps() { _wallet = null; CurrPass.Clear(); NewPass.Clear(); ConfPass.Clear(); }
public static Airline CreateFromFactory() { Airline company = new Airline(); Creator[] creators = new Creator[4]; creators[0] = new NewPass(); creators[1] = new NewFreighter(); creators[2] = new NewAgri(); creators[3] = new NewMilitary(); foreach (var item in creators) { if (item is NewPass) { company.Add(item.FactoryMethod("Boeng-747", 30, 2000, 1800, 5, "EW-111", 301)); company.Add(item.FactoryMethod("Boeng-737", 32, 1800, 1900, 6, "ES-166", 340)); } if (item is NewFreighter) { company.Add(item.FactoryMethod("Airbus-900", 150, 3600, 3599, 2, "IT-866", 220)); } if (item is NewAgri) { company.Add(item.FactoryMethod("Messina-210", 12, 800, 500, 2, "BY-666", Atomization.Pescitides)); } if (item is NewMilitary) { company.Add(item.FactoryMethod("SU-425", 15, 1200, 1099, 1, 20171, WeaponType.Rocket)); } } return(company); }
protected internal void NewPassMethod() { dialog = new Dialog(false, "Jelszó megváltoztatása", OkMethod, () => { }, false); newPass = new NewPass(dialog.YesButton(), UsersMDataSet.SelectedRow.UserName); dialog.content = newPass; dialog.Start(); }
void OKButton_Click(object sender, RoutedEventArgs e) { User currentUser = SecurityManager.CurrentSessionInfo.CurrentUser; if (SecurityManager.CalculateSHA1(OldPass.Password) == currentUser.PASSWORD) { if (NewPass.Password == NewPassRepeated.Password) { currentUser.PASSWORD = NewPass.Password; if (Controller.Update(currentUser)) { ContentManager.PrintStatus("Паролата бе променена успешно."); this.Dispose(); } else { ErrorField.Visibility = Visibility.Collapsed; OldPass.Focus(); } } else { ErrorField.Visibility = Visibility.Visible; ErrorField.Text = "Новата ви парола не съвпада."; NewPass.Focus(); } } else { ErrorField.Visibility = Visibility.Visible; ErrorField.Text = "Не сте въвели правилно старата си парола"; OldPass.Focus(); } }
//public void StartRunLoading() //{ // grdAccountInfo.IsVisible = false; // grdChangePassword.IsVisible = false; // grdLogOut.IsVisible = false; // scrUserProfile.IsEnabled = false; // frmLoading.IsEnabled = true; // frmLoading.IsPlaying = true; // frmLoading.IsVisible = true; // NavigationPage.SetHasNavigationBar(this, false); //} //public void StopRunLoading() //{ // grdAccountInfo.IsVisible = true; // grdChangePassword.IsVisible = true; // grdLogOut.IsVisible = true; // scrUserProfile.IsEnabled = true; // frmLoading.IsEnabled = false; // frmLoading.IsPlaying = false; // frmLoading.IsVisible = false; // NavigationPage.SetHasNavigationBar(this, true); //} private async void btnSaveChangePassword_Clicked(object sender, EventArgs e) { if (!string.IsNullOrEmpty(UserNameChange) && !string.IsNullOrEmpty(CurrentPass) && !string.IsNullOrEmpty(NewPassConfirm) && tblErrNewPassConfirm.TextColor == Color.FromHex("#00FF00") && !string.IsNullOrEmpty(NewPass) && tblErrNewPass.IsVisible == false) { tblUserNameChange.IsVisible = false; tblCurrentPass.IsVisible = false; tblNewPass.IsVisible = false; tblNewPassConfirm.IsVisible = false; UserChangePassModel _UserChangePass = new UserChangePassModel(); _UserChangePass.UserName = UserNameChange.Trim(); _UserChangePass.CurrentPassword = CurrentPass.Trim(); _UserChangePass.NewPassword = NewPass.Trim(); string url = "http://" + Global.Intance.SerIpAdress + ":" + Global.Intance.SerPortAPI + "/api/ChangePassword"; try { var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); var fileName = Path.Combine(documents, "cookie.txt"); var cookie = File.ReadAllText(fileName); HttpClient client = new HttpClient(); string jsonData = JsonConvert.SerializeObject(_UserChangePass); StringContent content = new StringContent(jsonData, Encoding.UTF8, "application/json"); content.Headers.Add("Cookie", cookie); HttpResponseMessage response = await client.PostAsync(url, content); string result = await response.Content.ReadAsStringAsync(); var responseData = JsonConvert.DeserializeObject <RespondModel>(result); var message = responseData.Content; if (responseData.Result == true) { await Navigation.PushAsync(new EditUserProfilePage(userProfileModel)); DependencyService.Get <IMessage>().ShortTime(message[0].ToString()); } else { //DependencyService.Get<IMessage>().Longtime(message[0].ToString()); await DisplayAlert("Thông báo", message[0].ToString(), "OK"); } } catch (Exception ex) { var Err = "Không nết nối được máy chủ"; DependencyService.Get <IMessage>().LongTime(Err); } } else { await DisplayAlert("Thông báo", "Vui lòng nhập thông tin hợp lệ!", "OK"); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (Account.Password == PasswordBox.ToString()) { if (NewPass.ToString() == Confirm.ToString()) { Account.Password = NewPass.Password; _context.Entry(Account).State = System.Data.Entity.EntityState.Modified; _context.SaveChanges(); SuccessMessage sm = new SuccessMessage(); sm.MessageText.Text = "Password Changed"; sm.Show(); } } }
private void SaveButton_Click(object sender, EventArgs e) { if (!NewPass.Equals(CfNewPass)) { XtraMessageBox.Show("Mật khẩu không hợp lệ!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } try { _presenter.Save(); XtraMessageBox.Show("Đổi mật khẩu thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (Exception ex) { XtraMessageBox.Show("Mật khẩu không hợp lệ!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public IHttpActionResult resetPass(NewPass newPass) { if (newPass == null) { throw new HttpResponseException(HttpStatusCode.BadRequest); } GestorRecovery resetPass = new GestorRecovery(); bool changePass = resetPass.Recovery(newPass); if (changePass) { System.Diagnostics.Debug.WriteLine("cambió el pass"); return(Ok("Contraseña modificada")); } else { return(Unauthorized()); } }
public async Task <IActionResult> OnPostChangePassword() { string nameOfCurrentUser = User.Identity.Name; AppUser = await _userManager.FindByNameAsync(nameOfCurrentUser); if (NewPass.Equals(ConfirmPass)) { await _userManager.ChangePasswordAsync(AppUser, OldPass, NewPass); return(RedirectToPage()); } else { OnPasswordFailure = true; } await OnGet(); return(Page()); }