private void btn_submit_Click(object sender, RoutedEventArgs e) { Authentication.Authentication auth = new Authentication.Authentication(); GamePlay.GameRounds rounds = new GamePlay.GameRounds(); auth.UserName = txt_Username.Text.Trim(); auth.Password = txt_oldPswd.Password.ToString().Trim(); auth.NewPassword = txt_newPswd.Password.ToString().Trim(); string stus = auth.ChangePassword(); if (stus == string.Empty) { var res = MessageBox.Show(stus, "Error Information", MessageBoxButton.OK, MessageBoxImage.Error); auth.error_flag = string.Empty; if (res.ToString() == "OK") { txt_Username.Text = string.Empty; txt_oldPswd.Password = string.Empty; txt_newPswd.Password = string.Empty; this.Show(); } } else { MessageBox.Show(stus, "Information", MessageBoxButton.OK, MessageBoxImage.Information); this.Close(); } }
public async Task <IActionResult> ChangePassword([FromForm] string userName, [FromForm] string password, [FromForm] string confirm, [FromForm] string currentPassword) { if (password != confirm) { return(Conflict("Пароли не совпадают")); } var user = await _auth.ChangePassword(userName, password, currentPassword); if (user == null) { return(NotFound($"\"{userName}\" не найден")); } return(Ok(user)); }