Beispiel #1
0
 static void ValidatePasswordConfirmation(ChangePasswordRequestModel inputModel)
 {
     if (!inputModel.Password.Equals(inputModel.PasswordConfirmation))
     {
         throw new PasswordConfirmationMismatchException();
     }
 }
Beispiel #2
0
 static void ValidateOldPassword(ChangePasswordRequestModel inputModel, User user)
 {
     if (!inputModel.OldPassword.Equals(user.Password))
     {
         throw new OldPasswordMismatchException();
     }
 }
Beispiel #3
0
        public void Invoke(ChangePasswordRequestModel inputModel,
                           IResponseBoundary <ChangePasswordResponseModel> responder)
        {
            var user = GetExistingUser(inputModel.UserId);

            Validate(inputModel, user);
            UpdateUser(inputModel, user);
            responder.Respond(CreateResponseModel());
        }
Beispiel #4
0
 void UpdateUser(ChangePasswordRequestModel inputModel, User user)
 {
     user.Password = inputModel.Password;
     UserRepository.Update(user);
 }
Beispiel #5
0
 static void Validate(ChangePasswordRequestModel inputModel, User user)
 {
     ValidatePasswordConfirmation(inputModel);
     ValidateOldPassword(inputModel, user);
 }