|
26 | 26 | import java.security.NoSuchAlgorithmException; |
27 | 27 | import java.security.SecureRandom; |
28 | 28 | import java.security.spec.InvalidKeySpecException; |
| 29 | +import java.util.concurrent.CompletableFuture; |
29 | 30 | import java.util.ArrayList; |
30 | 31 | import java.util.HashMap; |
31 | 32 | import java.util.HashSet; |
@@ -469,15 +470,15 @@ public int setForgetPassword(User user, String loginpass, String transactionId, |
469 | 470 | int count = 0; |
470 | 471 | try { |
471 | 472 | if (isAdmin != null && isAdmin == true) { |
472 | | - updateCTIPasswordForUserV1(user.getUserID(), loginpass); |
| 473 | + updateCTIPasswordInBackground(user.getUserID(), loginpass); |
473 | 474 | loginpass = securePassword.generateStrongPassword(loginpass); |
474 | 475 | count = iEMRUserRepositoryCustom.updateSetForgetPassword(user.getUserID(), loginpass); |
475 | 476 | } else { |
476 | 477 | String tokenFromRedis = sessionObject |
477 | 478 | .getSessionObjectForChangePassword((user.getUserID().toString() + user.getUserName())); |
478 | 479 | if (tokenFromRedis.equalsIgnoreCase(transactionId)) { |
479 | 480 |
|
480 | | - updateCTIPasswordForUserV1(user.getUserID(), loginpass); |
| 481 | + updateCTIPasswordInBackground(user.getUserID(), loginpass); |
481 | 482 | loginpass = securePassword.generateStrongPassword(loginpass); |
482 | 483 | count = iEMRUserRepositoryCustom.updateSetForgetPassword(user.getUserID(), loginpass); |
483 | 484 | // Deleting transaction Id |
@@ -600,6 +601,15 @@ public void updateCTIPasswordForUser(Long userID, String password) { |
600 | 601 | } |
601 | 602 | } |
602 | 603 |
|
| 604 | + /** |
| 605 | + * Sends the new password to the CTI server without making the user wait: called from this class, so the |
| 606 | + * {@code @Async} of updateCTIPasswordForUserV1 is not applied (no proxy) and an unreachable CTI server held the |
| 607 | + * password screen until the network timeout - before the password was even saved. |
| 608 | + */ |
| 609 | + void updateCTIPasswordInBackground(Long userID, String password) { |
| 610 | + CompletableFuture.runAsync(() -> updateCTIPasswordForUserV1(userID, password)); |
| 611 | + } |
| 612 | + |
603 | 613 | @Async |
604 | 614 | public void updateCTIPasswordForUserV1(Long userID, String password) { |
605 | 615 | try { |
|
0 commit comments