A self hosted chat application with end-to-end encrypted messaging.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
918 B

  1. package org.ros.chatto.captcha;
  2. import java.awt.image.BufferedImage;
  3. import lombok.Builder;
  4. @Builder
  5. public class WebCaptcha {
  6. private final CaptchaBehaviour captchaBehaviour;
  7. public BufferedImage generateCaptcha() {
  8. return captchaBehaviour.generateCaptcha();
  9. }
  10. public BufferedImage generateCaptcha(String captchaText) {
  11. return captchaBehaviour.generateCaptcha(captchaText);
  12. }
  13. public String getRandomChars() {
  14. return captchaBehaviour.getRandomChars();
  15. }
  16. public String getRandomChars(int quantity) {
  17. return captchaBehaviour.getRandomChars(quantity);
  18. }
  19. }
  20. // WebCaptcha webCaptcha = WebCaptcha.builder().captchaBehaviour(new
  21. // SimpleCaptchaBehavior()).build();
  22. // webCaptcha.generateCaptcha();
  23. //
  24. // // @formatter:off
  25. // webCaptcha = WebCaptcha.builder()
  26. // .captchaBehaviour(
  27. // ManualCaptchaBehaviour.builder()
  28. // .length(8)
  29. // .style("black")
  30. // .build()
  31. // ).build();
  32. //
  33. // // @formatter:on