-
Notifications
You must be signed in to change notification settings - Fork 847
优化微软登录页面 #4794
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
优化微软登录页面 #4794
Changes from 4 commits
51b2592
be5b6e5
8f70501
116f3f9
261deaa
3a10ded
f1f849a
9bc23ed
29db118
a97f659
80d6abe
101f342
894bc65
80e0b24
38f5f44
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -152,6 +152,12 @@ public void grantDeviceCode(String userCode, String verificationURI) { | |
| @Override | ||
| public void openBrowser(String url) throws IOException { | ||
| lastlyOpenedURL = url; | ||
|
|
||
| try { | ||
| Thread.sleep(3000); | ||
| } catch (InterruptedException ignored) { | ||
| } | ||
|
Comment on lines
+156
to
+159
|
||
|
|
||
| FXUtils.openLink(url); | ||
|
|
||
| onOpenBrowser.fireEvent(new OpenBrowserEvent(this, url)); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -35,8 +35,6 @@ | |||||||
| import javafx.scene.control.Label; | ||||||||
| import javafx.scene.control.TextInputControl; | ||||||||
| import javafx.scene.layout.*; | ||||||||
|
|
||||||||
| import org.jackhuang.hmcl.Metadata; | ||||||||
| import org.jackhuang.hmcl.auth.AccountFactory; | ||||||||
| import org.jackhuang.hmcl.auth.CharacterSelector; | ||||||||
| import org.jackhuang.hmcl.auth.NoSelectedCharacterException; | ||||||||
|
|
@@ -65,11 +63,7 @@ | |||||||
| import org.jackhuang.hmcl.util.javafx.BindingMapping; | ||||||||
| import org.jetbrains.annotations.Nullable; | ||||||||
|
|
||||||||
| import java.util.ArrayList; | ||||||||
| import java.util.List; | ||||||||
| import java.util.Locale; | ||||||||
| import java.util.Map; | ||||||||
| import java.util.UUID; | ||||||||
| import java.util.*; | ||||||||
| import java.util.concurrent.CountDownLatch; | ||||||||
| import java.util.regex.Pattern; | ||||||||
|
|
||||||||
|
|
@@ -287,72 +281,95 @@ private void initDetailsPane() { | |||||||
| btnAccept.disableProperty().unbind(); | ||||||||
| detailsContainer.getChildren().remove(detailsPane); | ||||||||
| lblErrorMessage.setText(""); | ||||||||
| lblErrorMessage.setVisible(true); | ||||||||
| } | ||||||||
|
|
||||||||
| if (factory == Accounts.FACTORY_MICROSOFT) { | ||||||||
| VBox vbox = new VBox(8); | ||||||||
| if (!Accounts.OAUTH_CALLBACK.getClientId().isEmpty()) { | ||||||||
| HintPane hintPane = new HintPane(MessageDialogPane.MessageType.INFO); | ||||||||
| FXUtils.onChangeAndOperate(deviceCode, deviceCode -> { | ||||||||
| if (deviceCode != null) { | ||||||||
| FXUtils.copyText(deviceCode.getUserCode()); | ||||||||
| hintPane.setSegment(i18n("account.methods.microsoft.manual", deviceCode.getUserCode(), deviceCode.getVerificationUri())); | ||||||||
| } else { | ||||||||
| hintPane.setSegment(i18n("account.methods.microsoft.hint")); | ||||||||
| } | ||||||||
| }); | ||||||||
| FXUtils.onClicked(hintPane, () -> { | ||||||||
| if (deviceCode.get() != null) { | ||||||||
| FXUtils.copyText(deviceCode.get().getUserCode()); | ||||||||
| } | ||||||||
| }); | ||||||||
|
|
||||||||
| holder.add(Accounts.OAUTH_CALLBACK.onGrantDeviceCode.registerWeak(value -> { | ||||||||
| runInFX(() -> deviceCode.set(value)); | ||||||||
| })); | ||||||||
| FlowPane box = new FlowPane(); | ||||||||
| box.setHgap(8); | ||||||||
| JFXHyperlink birthLink = new JFXHyperlink(i18n("account.methods.microsoft.birth")); | ||||||||
| birthLink.setExternalLink("https://support.microsoft.com/account-billing/837badbc-999e-54d2-2617-d19206b9540a"); | ||||||||
| JFXHyperlink profileLink = new JFXHyperlink(i18n("account.methods.microsoft.profile")); | ||||||||
| profileLink.setExternalLink("https://account.live.com/editprof.aspx"); | ||||||||
| JFXHyperlink purchaseLink = new JFXHyperlink(i18n("account.methods.microsoft.purchase")); | ||||||||
| purchaseLink.setExternalLink(YggdrasilService.PURCHASE_URL); | ||||||||
| JFXHyperlink deauthorizeLink = new JFXHyperlink(i18n("account.methods.microsoft.deauthorize")); | ||||||||
| deauthorizeLink.setExternalLink("https://account.live.com/consent/Edit?client_id=000000004C794E0A"); | ||||||||
| JFXHyperlink forgotpasswordLink = new JFXHyperlink(i18n("account.methods.forgot_password")); | ||||||||
| forgotpasswordLink.setExternalLink("https://account.live.com/ResetPassword.aspx"); | ||||||||
| JFXHyperlink createProfileLink = new JFXHyperlink(i18n("account.methods.microsoft.makegameidsettings")); | ||||||||
| createProfileLink.setExternalLink("https://www.minecraft.net/msaprofile/mygames/editprofile"); | ||||||||
| JFXHyperlink bannedQueryLink = new JFXHyperlink(i18n("account.methods.ban_query")); | ||||||||
| bannedQueryLink.setExternalLink("https://enforcement.xbox.com/enforcement/showenforcementhistory"); | ||||||||
| box.getChildren().setAll(profileLink, birthLink, purchaseLink, deauthorizeLink, forgotpasswordLink, createProfileLink, bannedQueryLink); | ||||||||
| GridPane.setColumnSpan(box, 2); | ||||||||
|
|
||||||||
| if (!IntegrityChecker.isOfficial()) { | ||||||||
| HintPane unofficialHint = new HintPane(MessageDialogPane.MessageType.WARNING); | ||||||||
| unofficialHint.setText(i18n("unofficial.hint")); | ||||||||
| vbox.getChildren().add(unofficialHint); | ||||||||
| } | ||||||||
|
|
||||||||
| vbox.getChildren().addAll(hintPane, box); | ||||||||
| detailsPane = vbox; | ||||||||
|
|
||||||||
| btnAccept.setDisable(false); | ||||||||
| } else { | ||||||||
| if (Accounts.OAUTH_CALLBACK.getClientId().isEmpty()) { | ||||||||
| HintPane hintPane = new HintPane(MessageDialogPane.MessageType.WARNING); | ||||||||
| hintPane.setSegment(i18n("account.methods.microsoft.snapshot")); | ||||||||
| vbox.getChildren().add(hintPane); | ||||||||
|
||||||||
| vbox.getChildren().add(hintPane); | |
| vbox.getChildren().add(hintPane); | |
| detailsContainer.getChildren().add(detailsPane); |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The font size is set using an inline style string ("-fx-font-size: 24"). This could cause inconsistency with the application's theme. Consider defining a CSS class for the code display or using the theme's font sizes for consistency.
| code.setStyle("-fx-font-size: 24"); | |
| code.getStyleClass().add("microsoft-device-code"); |
Copilot
AI
Dec 3, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The HBox linkBox is created without spacing between hyperlinks. The previous code used FlowPane with setHgap(8) to provide spacing. Consider setting spacing for the HBox: HBox linkBox = new HBox(8); to maintain visual consistency.
| HBox linkBox = new HBox(); | |
| HBox linkBox = new HBox(8); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉强制等待三秒会影响到了解登陆流程的用户的使用体验,可能需要更好的逻辑来改善用户体验。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个实际上问题不大,登录微软账户也不是什么需要频繁进行的操作
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我使用的时候对这个硬控三秒感到很烦躁。至少对我个人来说,这个非常影响使用体验。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
实际上其他启动器也是类似的逻辑。如果你依然认为有必要更改,可以直接缩短此处的时间。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以把等待时间改短一点。我觉得 1s 或 2s 应该够了。