Пример #1
0
        public void ChangePassword_ReturnTrue(string password)
        {
            // arrange
            string newPassword = password;

            // act
            bool actualResult = user.ChangePassword(newPassword);

            // assert
            Assert.AreEqual(true, actualResult);
        }
 private void Btn_Save_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (userLogic.ChangePassword(TB_OldPassword.Password.ToString(), TB_NewPOne.Password.ToString(), TB_NewPTwo.Password.ToString(), ChBox_Reset.IsChecked, _selectedUser))
         {
             DialogResult = true;
             this.Close();
         }
         else
         {
             Lbl_Warning.Content    = "Something went wrong.";
             Lbl_Warning.Visibility = Visibility.Visible;
         }
     }
     catch (PasswordNotFound ex)
     {
         Lbl_Warning.Content        = ex.Message;
         TB_OldPassword.BorderBrush = new SolidColorBrush(Color.FromRgb(179, 171, 171));
         TB_OldPassword.Background  = new SolidColorBrush(Color.FromRgb(255, 255, 255));
     }
     catch (Exception ex)
     {
         Lbl_Warning.Content = ex.Message;
     }
     finally
     {
         Lbl_Warning.Visibility = Visibility.Visible;
     }
 }
Пример #3
0
        public HttpResponseMessage UpdatePassword(string userId, ChangePassword model)
        {
            Initialize();
            var status = logic.ChangePassword(userId, model.CurrentPassword, model.NewPassword);

            if (status)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "Updated"));
            }
            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.ExpectationFailed, logic.ErrorMessage));
            }
        }
Пример #4
0
        public ActionResult ChangePassword(FormCollection form)
        {
            var oldPassword = form["oldPassword"];
            var newPassword = form["newPassword"];

            var userSvc = new UserLogic(Ticket);
            if (userSvc.ChangePassword(oldPassword, newPassword))
            {
                DisplayInformation("Your password has been successfully changed.");
                return RedirectToAction("Profile");
            }
            else
            {
                DisplayError(userSvc.ErrorMessage);
                return View();
            }
        }
Пример #5
0
 public HttpResponseMessage ChangePassword(UserDTO userDTO)
 {
     UserLogic.ChangePassword(userDTO);
     return(Request.CreateResponse(HttpStatusCode.OK));
 }