Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class LoginSecurityConfig extends AbstractConfig {
private int passwordMinLength = 6;
@ConfigKey(path="password-max-length")
private int passwordMaxLength = 32;
@ConfigHeader("Allow players to use their username as a password.")
@ConfigKey(path="password.allow-username-as-password")
private boolean allowUsernameAsPassword = true;

/**
* Join settings.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public void execute() {
return;
}

if(!config.isAllowUsernameAsPassword() && player.getName().equalsIgnoreCase(password)) {
reply(false, translate(ERROR_PASSWORD_SAME_AS_USERNAME));
return;
}

if(config.isRegisterCaptcha()) {
CaptchaManager captcha = plugin.getModule(CaptchaManager.class);
captcha.giveMapItem(player, () -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public enum LanguageKeys {
ERROR_REFRESH_PROFILE("errorRefreshProfile"),
ERROR_NOT_REGISTERED("errorNotRegistered"),
ERROR_MATCH_PASSWORD("errorMatchPassword"),
ERROR_PASSWORD_SAME_AS_USERNAME("errorPasswordSameAsUsername"),
/**
* Kick messages
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/lang
Submodule lang updated 1 files
+1 −0 en_us.json