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

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