mirror of
https://github.com/exzork/GCAuth.git
synced 2024-11-30 18:58:54 +00:00
stupid me
This commit is contained in:
parent
a512478cfc
commit
ac1c4b57d2
@ -56,16 +56,17 @@ public final class Authentication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String generateOTP(Account account) {
|
public static String generateOTP(Account account) {
|
||||||
String token = Authentication.generateRandomNumber(6);
|
String otp = Authentication.generateRandomNumber(6);
|
||||||
Authentication.otps.put(token, account.getUsername());
|
while (otps.containsKey(otp)) {
|
||||||
return token;
|
GCAuth.getInstance().getLogger().info("OTP already in use, generating new one");
|
||||||
|
otp = Authentication.generateRandomNumber(6);
|
||||||
|
}
|
||||||
|
Authentication.otps.put(otp, account.getUsername());
|
||||||
|
return otp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String generateJwt(Account account) {
|
public static String generateJwt(Account account) {
|
||||||
String otp = generateOTP(account);
|
String otp = generateOTP(account);
|
||||||
while (otps.get(otp) != null) {
|
|
||||||
otp = generateOTP(account);
|
|
||||||
}
|
|
||||||
watchOTP(otp);
|
watchOTP(otp);
|
||||||
return JWT.create()
|
return JWT.create()
|
||||||
.withClaim("token", otp)
|
.withClaim("token", otp)
|
||||||
|
Loading…
Reference in New Issue
Block a user