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.
|
|
package org.ros.chatto.captcha;
import java.awt.image.BufferedImage; import java.util.Random;
public class SimpleCaptchaBehavior implements CaptchaBehaviour { @Override public BufferedImage generateCaptcha() { SimpleCaptcha simpleCaptcha = new SimpleCaptcha(); return simpleCaptcha.getImagePng(); } @Override public BufferedImage generateCaptcha(String captchaText) { SimpleCaptcha simpleCaptcha = new SimpleCaptcha(captchaText); return simpleCaptcha.getImagePng(); } public String getRandomChars() { return getRandomChars(8); } public String getRandomChars(int quantity) { char[] randomString = new char[quantity];
Random random = new Random();
int capitalLetter;
for (int i = 0; i < quantity; i++) { capitalLetter = 65 + random.nextInt(26); randomString[i] = (char) capitalLetter; }
return new String(randomString); }
}
|