mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-03-30 21:18:17 +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) {
|
if (report.success) {
|
||||||
logger.info("Password correct");
|
logger.info("Password correct");
|
||||||
} else {
|
} else {
|
||||||
if (report.needMoreFactor) {
|
if (report.needMoreFactors) {
|
||||||
if (report.factors.size() == 1 && report.factors.get(0) == -1) {
|
if (report.factors.size() == 1 && report.factors.get(0) == -1) {
|
||||||
logger.info("Password not correct: Required 2FA");
|
logger.info("Password not correct: Required 2FA");
|
||||||
} else {
|
} else {
|
||||||
|
@ -345,30 +345,30 @@ public static class PasswordVerifyReport {
|
||||||
public static final PasswordVerifyReport FAILED = new PasswordVerifyReport(false);
|
public static final PasswordVerifyReport FAILED = new PasswordVerifyReport(false);
|
||||||
public static final PasswordVerifyReport OK = new PasswordVerifyReport(true);
|
public static final PasswordVerifyReport OK = new PasswordVerifyReport(true);
|
||||||
public final boolean success;
|
public final boolean success;
|
||||||
public final boolean needMoreFactor;
|
public final boolean needMoreFactors;
|
||||||
public final List<Integer> factors;
|
public final List<Integer> factors;
|
||||||
|
|
||||||
public PasswordVerifyReport(boolean success) {
|
public PasswordVerifyReport(boolean success) {
|
||||||
this.success = success;
|
this.success = success;
|
||||||
this.needMoreFactor = false;
|
this.needMoreFactors = false;
|
||||||
this.factors = List.of();
|
this.factors = List.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PasswordVerifyReport(int nextFactor) {
|
public PasswordVerifyReport(int nextFactor) {
|
||||||
this.success = false;
|
this.success = false;
|
||||||
this.needMoreFactor = true;
|
this.needMoreFactors = true;
|
||||||
this.factors = List.of(nextFactor);
|
this.factors = List.of(nextFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PasswordVerifyReport(List<Integer> factors) {
|
public PasswordVerifyReport(List<Integer> factors) {
|
||||||
this.success = false;
|
this.success = false;
|
||||||
this.needMoreFactor = false;
|
this.needMoreFactors = false;
|
||||||
this.factors = Collections.unmodifiableList(factors);
|
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.success = success;
|
||||||
this.needMoreFactor = needMoreFactor;
|
this.needMoreFactors = needMoreFactors;
|
||||||
this.factors = factors;
|
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());
|
internalAuth(context.client, context.authType, context.pair, user.getUsername(), user.getUUID(), user.getPermissions(), result.isUsingOAuth());
|
||||||
return result;
|
return result;
|
||||||
} else {
|
} else {
|
||||||
if (report.needMoreFactor) {
|
if (report.needMoreFactors) {
|
||||||
if (report.factors.size() == 1 && report.factors.get(0) == -1) {
|
if (report.factors.size() == 1 && report.factors.get(0) == -1) {
|
||||||
throw new AuthException(AuthRequestEvent.TWO_FACTOR_NEED_ERROR_MESSAGE);
|
throw new AuthException(AuthRequestEvent.TWO_FACTOR_NEED_ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue