Skip to content

Commit

Permalink
[FIX] Support Sudo
Browse files Browse the repository at this point in the history
  • Loading branch information
gravit0 committed Feb 7, 2024
1 parent f3d5652 commit 93c04ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package pro.gravit.launcher.client.gui.impl;

import javafx.application.Platform;
import pro.gravit.launcher.client.gui.JavaFXApplication;
import pro.gravit.launcher.client.gui.scenes.AbstractScene;
import pro.gravit.launcher.client.gui.scenes.login.LoginScene;
Expand Down Expand Up @@ -37,7 +38,10 @@ public <T extends WebSocketEvent> boolean eventHandle(T event) {
LogHelper.dev("Receive auth event. Send next scene %s", isNextScene ? "true" : "false");
application.authService.setAuthResult(null, authRequestEvent);
if (isNextScene && ((LoginScene) application.getCurrentScene()).isLoginStarted)
((LoginScene) application.getCurrentScene()).onGetProfiles();
((LoginScene) application.getCurrentScene()).onSuccessLogin(
new LoginScene.SuccessAuth(authRequestEvent,
authRequestEvent.playerProfile != null ? authRequestEvent.playerProfile.username : null,
null));
}
if (event instanceof ProfilesRequestEvent profilesRequestEvent) {
application.profilesService.setProfilesResult(profilesRequestEvent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ public void addAuthAvailability(GetAvailabilityAuthRequestEvent.AuthAvailability

public <T extends WebSocketEvent> void processing(Request<T> request, String text, Consumer<T> onSuccess,
Consumer<String> onError) {
processRequest(text, request, onSuccess, (thr) -> onError.accept(thr.getCause().getMessage()), null);
contextHelper.runInFxThread(() -> {
processRequest(text, request, onSuccess, (thr) -> onError.accept(thr.getCause().getMessage()), null);
});
}


Expand Down Expand Up @@ -296,7 +298,7 @@ private boolean checkSavePasswordAvailable(AuthRequest.AuthPasswordInterface pas
&& authAvailability.details.get(0) instanceof AuthPasswordDetails;
}

private void onSuccessLogin(SuccessAuth successAuth) {
public void onSuccessLogin(SuccessAuth successAuth) {
AuthRequestEvent result = successAuth.requestEvent;
application.authService.setAuthResult(authAvailability.name, result);
boolean savePassword = savePasswordCheckBox.isSelected();
Expand Down

0 comments on commit 93c04ba

Please sign in to comment.