Email verification code (#1382)

* Base verification code implementation, must define command, manager, events
* VerificationManager, verification command and messages, handled some sensible commands, configuration values
* Improved manager and sensible commands trigger
* Updated messages
* Updated verification code manager, fixed tests
* Switched to a permission based command
* Verification manager and command improved and added tests
* Edited messages
This commit is contained in:
HexelDev
2017-10-28 12:23:14 +02:00
committed by ljacqu
parent 8422581a82
commit ba65633182
58 changed files with 1227 additions and 67 deletions
@@ -10,8 +10,9 @@ public final class RandomStringUtils {
private static final char[] CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray();
private static final Random RANDOM = new SecureRandom();
private static final int HEX_MAX_INDEX = 16;
private static final int NUM_INDEX = 10;
private static final int LOWER_ALPHANUMERIC_INDEX = 36;
private static final int HEX_MAX_INDEX = 16;
// Utility class
private RandomStringUtils() {
@@ -38,6 +39,17 @@ public final class RandomStringUtils {
return generateString(length, HEX_MAX_INDEX);
}
/**
* Generate a random numbers string of the given length. In other words, the generated string
* contains characters only within the range [0-9].
*
* @param length The length of the random string to generate
* @return The random numbers string
*/
public static String generateNum(int length) {
return generateString(length, NUM_INDEX);
}
/**
* Generate a random string with digits and lowercase and uppercase letters. The result of this
* method matches the pattern [0-9a-zA-Z].