Skip to content

Commit

Permalink
feat(sandside): #198 limit the number of generated passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
Marthym committed Jan 14, 2024
1 parent c3035da commit 48b4344
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public Mono<PasswordEvaluation> checkPasswordStrength(User user) {

@Override
public Flux<String> generateSecurePassword(int number) {
if (number > 100 || number < 1) {
return Flux.error(() -> new IllegalArgumentException("Invalid number of passwords required !"));
}
return Flux.<String>create(sink ->
sink.onRequest(n -> LongStream.range(0, number)
.mapToObj(ignore -> passwordChecker.generate())
Expand Down

0 comments on commit 48b4344

Please sign in to comment.