diff --git a/app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/UserController.java b/app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/UserController.java index 50741e58a6..97b69b0bc2 100644 --- a/app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/UserController.java +++ b/app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/UserController.java @@ -628,7 +628,8 @@ public class UserController { .body(Map.of("error", "Email is not configured.")); } - if (user.getEmail() == null || user.getEmail().isBlank()) { + String userEmail = user.getUsername(); + if (userEmail == null || userEmail.isBlank()) { return ResponseEntity.status(HttpStatus.BAD_REQUEST) .body(Map.of("error", "User does not have an email address.")); } @@ -637,7 +638,10 @@ public class UserController { emailService .get() .sendPasswordChangedNotification( - user.getEmail(), user.getUsername(), includePassword ? finalPassword : null, loginUrl); + userEmail, + user.getUsername(), + includePassword ? finalPassword : null, + loginUrl); } return ResponseEntity.ok(Map.of("message", "User password updated successfully"));