@@ -51,14 +51,38 @@ public DialogWindowSpec createPreJoinLoginDialog(String playerName) {
5151 boolean showRecovery = commonService .getProperty (RegistrationSettings .DIALOG_SHOW_FORGOT_PASSWORD_BUTTON )
5252 && emailService .hasAllInformation ();
5353 boolean showBody = commonService .getProperty (RegistrationSettings .DIALOG_SHOW_BODY );
54+ Function <MessageKey , String > text = key -> messages .retrieveSingle (playerName , key );
55+
5456 // When recovery is shown it occupies the secondary button slot, so cancel button is suppressed.
5557 // Escape is also disabled: the player must either submit, use recovery, or disconnect.
56- return createLoginDialogSpec (
57- key -> messages .retrieveSingle (playerName , key ),
58- showRecovery ,
59- !showRecovery && commonService .getProperty (RegistrationSettings .PRE_JOIN_DIALOG_SHOW_CANCEL_BUTTON ),
60- !showRecovery && commonService .getProperty (RegistrationSettings .PRE_JOIN_DIALOG_ALLOW_CLOSE_WITH_ESCAPE ),
61- showBody );
58+ boolean showCancelButton = !showRecovery && commonService .getProperty (RegistrationSettings .PRE_JOIN_DIALOG_SHOW_CANCEL_BUTTON );
59+ boolean canCloseWithEscape = !showRecovery && commonService .getProperty (RegistrationSettings .PRE_JOIN_DIALOG_ALLOW_CLOSE_WITH_ESCAPE );
60+
61+ // Password field only — email is collected on a separate recovery page if needed
62+ return new DialogWindowSpec (
63+ text .apply (MessageKey .DIALOG_LOGIN_TITLE ),
64+ List .of (new DialogInputSpec ("password" , text .apply (MessageKey .DIALOG_LOGIN_PASSWORD ), DEFAULT_MAX_INPUT_LENGTH )),
65+ text .apply (MessageKey .DIALOG_LOGIN_BUTTON ),
66+ showRecovery ? text .apply (MessageKey .DIALOG_LOGIN_RECOVERY_BUTTON ) : text .apply (MessageKey .DIALOG_CANCEL_BUTTON ),
67+ showRecovery || showCancelButton ,
68+ canCloseWithEscape ,
69+ showRecovery ? "forgot_password" : null ,
70+ showBody ? text .apply (MessageKey .DIALOG_LOGIN_BODY ) : null );
71+ }
72+
73+ public DialogWindowSpec createPreJoinRecoveryDialog (String playerName ) {
74+ boolean showBody = commonService .getProperty (RegistrationSettings .DIALOG_SHOW_BODY );
75+ Function <MessageKey , String > text = key -> messages .retrieveSingle (playerName , key );
76+
77+ return new DialogWindowSpec (
78+ text .apply (MessageKey .DIALOG_RECOVERY_TITLE ),
79+ List .of (new DialogInputSpec ("email" , text .apply (MessageKey .DIALOG_RECOVERY_EMAIL ), DEFAULT_MAX_INPUT_LENGTH )),
80+ text .apply (MessageKey .DIALOG_RECOVERY_BUTTON ),
81+ text .apply (MessageKey .DIALOG_CANCEL_BUTTON ),
82+ true ,
83+ false ,
84+ null ,
85+ showBody ? text .apply (MessageKey .DIALOG_RECOVERY_BODY ) : null );
6286 }
6387
6488 public DialogWindowSpec createTotpDialog (Player player ) {
0 commit comments