@@ -32,7 +32,29 @@ public class DialogWindowService {
3232 }
3333
3434 public DialogWindowSpec createLoginDialog (Player player ) {
35- return createLoginDialogSpec (key -> getPostJoinMessage (player , key ), false , false );
35+ boolean showRecovery = commonService .getProperty (RegistrationSettings .DIALOG_SHOW_FORGOT_PASSWORD_BUTTON );
36+ boolean showBody = commonService .getProperty (RegistrationSettings .DIALOG_SHOW_BODY );
37+ Function <MessageKey , String > text = key -> getPostJoinMessage (player , key );
38+
39+ List <DialogInputSpec > inputs = new ArrayList <>();
40+ inputs .add (new DialogInputSpec ("password" ,
41+ text .apply (MessageKey .DIALOG_LOGIN_PASSWORD ),
42+ DEFAULT_MAX_INPUT_LENGTH ));
43+ if (showRecovery ) {
44+ inputs .add (new DialogInputSpec ("email" ,
45+ text .apply (MessageKey .DIALOG_LOGIN_RECOVERY_EMAIL ),
46+ DEFAULT_MAX_INPUT_LENGTH ));
47+ }
48+
49+ return new DialogWindowSpec (
50+ text .apply (MessageKey .DIALOG_LOGIN_TITLE ),
51+ inputs ,
52+ text .apply (MessageKey .DIALOG_LOGIN_BUTTON ),
53+ showRecovery ? text .apply (MessageKey .DIALOG_LOGIN_RECOVERY_BUTTON ) : text .apply (MessageKey .DIALOG_CANCEL_BUTTON ),
54+ showRecovery ,
55+ false ,
56+ showRecovery ? "email recover $(email)" : null ,
57+ showBody ? text .apply (MessageKey .DIALOG_LOGIN_BODY ) : null );
3658 }
3759
3860 public DialogWindowSpec createPreJoinLoginDialog (String playerName ) {
@@ -42,15 +64,20 @@ public DialogWindowSpec createPreJoinLoginDialog(String playerName) {
4264 }
4365
4466 public DialogWindowSpec createTotpDialog (Player player ) {
67+ boolean showBody = commonService .getProperty (RegistrationSettings .DIALOG_SHOW_BODY );
68+ Function <MessageKey , String > text = key -> getPostJoinMessage (player , key );
69+
4570 return new DialogWindowSpec (
46- getPostJoinMessage ( player , MessageKey .DIALOG_TWO_FACTOR_TITLE ),
71+ text . apply ( MessageKey .DIALOG_TWO_FACTOR_TITLE ),
4772 List .of (new DialogInputSpec ("code" ,
48- getPostJoinMessage ( player , MessageKey .DIALOG_TWO_FACTOR_CODE ),
73+ text . apply ( MessageKey .DIALOG_TWO_FACTOR_CODE ),
4974 TOTP_CODE_MAX_INPUT_LENGTH )),
50- getPostJoinMessage ( player , MessageKey .DIALOG_TWO_FACTOR_BUTTON ),
51- getPostJoinMessage ( player , MessageKey .DIALOG_CANCEL_BUTTON ),
75+ text . apply ( MessageKey .DIALOG_TWO_FACTOR_BUTTON ),
76+ text . apply ( MessageKey .DIALOG_CANCEL_BUTTON ),
5277 false ,
53- false );
78+ false ,
79+ null ,
80+ showBody ? text .apply (MessageKey .DIALOG_TWO_FACTOR_BODY ) : null );
5481 }
5582
5683 public DialogWindowSpec createRegisterDialog (Player player ,
@@ -70,6 +97,7 @@ public DialogWindowSpec createPreJoinRegisterDialog(String playerName,
7097 private DialogWindowSpec createLoginDialogSpec (Function <MessageKey , String > textResolver ,
7198 boolean showSecondaryButton ,
7299 boolean canCloseWithEscape ) {
100+ boolean showBody = commonService .getProperty (RegistrationSettings .DIALOG_SHOW_BODY );
73101 return new DialogWindowSpec (
74102 textResolver .apply (MessageKey .DIALOG_LOGIN_TITLE ),
75103 List .of (new DialogInputSpec ("password" ,
@@ -78,15 +106,19 @@ private DialogWindowSpec createLoginDialogSpec(Function<MessageKey, String> text
78106 textResolver .apply (MessageKey .DIALOG_LOGIN_BUTTON ),
79107 textResolver .apply (MessageKey .DIALOG_CANCEL_BUTTON ),
80108 showSecondaryButton ,
81- canCloseWithEscape );
109+ canCloseWithEscape ,
110+ null ,
111+ showBody ? textResolver .apply (MessageKey .DIALOG_LOGIN_BODY ) : null );
82112 }
83113
84114 private DialogWindowSpec createRegisterDialogSpec (RegistrationType type ,
85115 RegisterSecondaryArgument secondArg ,
86116 Function <MessageKey , String > textResolver ,
87117 boolean showSecondaryButton ,
88118 boolean canCloseWithEscape ) {
119+ boolean showBody = commonService .getProperty (RegistrationSettings .DIALOG_SHOW_BODY );
89120 List <DialogInputSpec > inputs = new ArrayList <>();
121+
90122 if (type == RegistrationType .EMAIL ) {
91123 inputs .add (new DialogInputSpec ("email" ,
92124 textResolver .apply (MessageKey .DIALOG_REGISTER_EMAIL ),
@@ -97,15 +129,21 @@ private DialogWindowSpec createRegisterDialogSpec(RegistrationType type,
97129 DEFAULT_MAX_INPUT_LENGTH ));
98130 }
99131 } else {
132+ // For EMAIL_MANDATORY: email is placed before password — it is the account identifier
133+ // and mirrors the signup order most players expect (email → then choose a password).
134+ if (secondArg == RegisterSecondaryArgument .EMAIL_MANDATORY ) {
135+ inputs .add (new DialogInputSpec ("email" ,
136+ textResolver .apply (MessageKey .DIALOG_REGISTER_EMAIL ),
137+ DEFAULT_MAX_INPUT_LENGTH ));
138+ }
100139 inputs .add (new DialogInputSpec ("password" ,
101140 textResolver .apply (MessageKey .DIALOG_REGISTER_PASSWORD ),
102141 DEFAULT_MAX_INPUT_LENGTH ));
103142 if (secondArg == RegisterSecondaryArgument .CONFIRMATION ) {
104143 inputs .add (new DialogInputSpec ("confirm" ,
105144 textResolver .apply (MessageKey .DIALOG_REGISTER_CONFIRM_PASSWORD ),
106145 DEFAULT_MAX_INPUT_LENGTH ));
107- } else if (secondArg == RegisterSecondaryArgument .EMAIL_MANDATORY
108- || secondArg == RegisterSecondaryArgument .EMAIL_OPTIONAL ) {
146+ } else if (secondArg == RegisterSecondaryArgument .EMAIL_OPTIONAL ) {
109147 inputs .add (new DialogInputSpec ("email" ,
110148 textResolver .apply (MessageKey .DIALOG_REGISTER_EMAIL ),
111149 DEFAULT_MAX_INPUT_LENGTH ));
@@ -118,7 +156,9 @@ private DialogWindowSpec createRegisterDialogSpec(RegistrationType type,
118156 textResolver .apply (MessageKey .DIALOG_REGISTER_BUTTON ),
119157 textResolver .apply (MessageKey .DIALOG_CANCEL_BUTTON ),
120158 showSecondaryButton ,
121- canCloseWithEscape );
159+ canCloseWithEscape ,
160+ null ,
161+ showBody ? textResolver .apply (MessageKey .DIALOG_REGISTER_BODY ) : null );
122162 }
123163
124164 private String getPostJoinMessage (Player player , MessageKey key ) {
0 commit comments