Skip to content

Commit 0b87959

Browse files
GlavoShulkerSakura
andauthored
[release/3.6] Added 16 characters length detection of username (#4580)
#4088 Co-authored-by: ShulkerSakura <50770360+ShulkerSakura@users.noreply.github.com>
1 parent ae18ca7 commit 0b87959

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

HMCL/src/main/java/org/jackhuang/hmcl/ui/account/CreateAccountPane.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ private void onAccept() {
267267
}).executor(true);
268268
};
269269

270-
if (factory instanceof OfflineAccountFactory && username != null && !USERNAME_CHECKER_PATTERN.matcher(username).matches()) {
270+
if (factory instanceof OfflineAccountFactory && username != null && (!USERNAME_CHECKER_PATTERN.matcher(username).matches() || username.length() > 16)) {
271271
JFXButton btnYes = new JFXButton(i18n("button.ok"));
272272
btnYes.getStyleClass().add("dialog-error");
273273
btnYes.setOnAction(e -> doCreate.run());

HMCL/src/main/resources/assets/lang/I18N.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ account.methods.microsoft.purchase=Buy Minecraft
124124
account.methods.microsoft.snapshot=You are using an unofficial build of HMCL. Please download the official build to log in.
125125
account.methods.microsoft.snapshot.website=Official Website
126126
account.methods.offline=Offline
127-
account.methods.offline.name.special_characters=Using only English letters, numbers, and underscores is recommended
127+
account.methods.offline.name.special_characters=Use only letters, numbers, and underscores (max 16 chars)
128128
account.methods.offline.name.invalid=It is recommended to use only English letters, numbers and underscores for the username, and the length should not exceed 16 characters.\n\
129129
\n\
130130
\ · Legitimate: HuangYu, huang_Yu, Huang_Yu_123;\n\

HMCL/src/main/resources/assets/lang/I18N_zh.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ account.methods.ban_query=查詢帳戶是否被封禁
131131
account.methods.microsoft.snapshot=你正在使用第三方提供的 HMCL。請下載官方版本進行登入。
132132
account.methods.microsoft.snapshot.website=官方網站
133133
account.methods.offline=離線模式
134-
account.methods.offline.name.special_characters=建議使用英文字母、數字以及底線命名
134+
account.methods.offline.name.special_characters=建議使用英文字母、數字以及底線命名,且長度不超過 16 個字元
135135
account.methods.offline.name.invalid=遊戲使用者名稱建議僅使用英文字母、數字及底線,且長度不超過 16 個字元。\n\
136136
\n\
137137
\ · 一些有效的使用者名稱:HuangYu、huang_Yu、Huang_Yu_123;\n\

HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ account.methods.ban_query=检测账户是否被封禁
139139
account.methods.microsoft.snapshot=你正在使用第三方提供的 HMCL。请下载官方版本来登录微软账户。
140140
account.methods.microsoft.snapshot.website=官方网站
141141
account.methods.offline=离线模式
142-
account.methods.offline.name.special_characters=建议使用英文字符、数字以及下划线命名
142+
account.methods.offline.name.special_characters=建议使用英文字符、数字以及下划线命名,且长度不超过 16 个字符
143143
account.methods.offline.name.invalid=游戏用户名建议仅使用英文字母、数字及下划线,且长度不超过 16 个字符。\n\
144144
\n\
145145
\ · 一些合法用户名:HuangYu、huang_Yu、Huang_Yu_123;\n\

0 commit comments

Comments
 (0)