mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 03:31:15 +03:00
[FIX] needMoreFactors
This commit is contained in:
parent
26ed69e1a7
commit
112ac31803
2 changed files with 8 additions and 8 deletions
|
@ -96,7 +96,7 @@ public void invoke(String... args) throws Exception {
|
|||
if (report.success) {
|
||||
logger.info("Password correct");
|
||||
} else {
|
||||
if (report.needMoreFactor) {
|
||||
if (report.needMoreFactors) {
|
||||
if (report.factors.size() == 1 && report.factors.get(0) == -1) {
|
||||
logger.info("Password not correct: Required 2FA");
|
||||
} else {
|
||||
|
@ -345,30 +345,30 @@ public static class PasswordVerifyReport {
|
|||
public static final PasswordVerifyReport FAILED = new PasswordVerifyReport(false);
|
||||
public static final PasswordVerifyReport OK = new PasswordVerifyReport(true);
|
||||
public final boolean success;
|
||||
public final boolean needMoreFactor;
|
||||
public final boolean needMoreFactors;
|
||||
public final List<Integer> factors;
|
||||
|
||||
public PasswordVerifyReport(boolean success) {
|
||||
this.success = success;
|
||||
this.needMoreFactor = false;
|
||||
this.needMoreFactors = false;
|
||||
this.factors = List.of();
|
||||
}
|
||||
|
||||
public PasswordVerifyReport(int nextFactor) {
|
||||
this.success = false;
|
||||
this.needMoreFactor = true;
|
||||
this.needMoreFactors = true;
|
||||
this.factors = List.of(nextFactor);
|
||||
}
|
||||
|
||||
public PasswordVerifyReport(List<Integer> factors) {
|
||||
this.success = false;
|
||||
this.needMoreFactor = false;
|
||||
this.needMoreFactors = false;
|
||||
this.factors = Collections.unmodifiableList(factors);
|
||||
}
|
||||
|
||||
private PasswordVerifyReport(boolean success, boolean needMoreFactor, List<Integer> factors) {
|
||||
private PasswordVerifyReport(boolean success, boolean needMoreFactors, List<Integer> factors) {
|
||||
this.success = success;
|
||||
this.needMoreFactor = needMoreFactor;
|
||||
this.needMoreFactors = needMoreFactors;
|
||||
this.factors = factors;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ public AuthReport auth(AuthResponse.AuthContext context, AuthRequest.AuthPasswor
|
|||
internalAuth(context.client, context.authType, context.pair, user.getUsername(), user.getUUID(), user.getPermissions(), result.isUsingOAuth());
|
||||
return result;
|
||||
} else {
|
||||
if (report.needMoreFactor) {
|
||||
if (report.needMoreFactors) {
|
||||
if (report.factors.size() == 1 && report.factors.get(0) == -1) {
|
||||
throw new AuthException(AuthRequestEvent.TWO_FACTOR_NEED_ERROR_MESSAGE);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue