diff --git a/docs/config.md b/docs/config.md index 51ee86a9c..9444bb83e 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1,5 +1,5 @@ - + ## AuthMe Configuration The first time you run AuthMe it will create a config.yml file in the plugins/AuthMe folder, @@ -37,6 +37,8 @@ DataSource: mySQLRealName: 'realname' # Column for storing players passwords mySQLColumnPassword: 'password' + # Column for storing players passwords salts + mySQLColumnSalt: '' # Column for storing players emails mySQLColumnEmail: 'email' # Column for storing if a player is logged in or not @@ -71,8 +73,6 @@ DataSource: # You should set this at least 30 seconds less than mysql server wait_timeout maxLifetime: 1800 ExternalBoardOptions: - # Column for storing players passwords salts - mySQLColumnSalt: '' # Column for storing players groups mySQLColumnGroup: '' # -1 means disabled. If you want that only activated players @@ -562,4 +562,4 @@ To change settings on a running server, save your changes to config.yml and use --- -This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Sun Apr 22 11:00:10 CEST 2018 +This page was automatically generated on the [AuthMe/AuthMeReloaded repository](https://github.com/AuthMe/AuthMeReloaded/tree/master/docs/) on Mon May 21 09:08:25 CEST 2018 diff --git a/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java b/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java index c5ab3fd7a..d95f73ce5 100644 --- a/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java +++ b/src/main/java/fr/xephi/authme/settings/SettingsMigrationService.java @@ -10,6 +10,7 @@ import fr.xephi.authme.output.LogLevel; import fr.xephi.authme.process.register.RegisterSecondaryArgument; import fr.xephi.authme.process.register.RegistrationType; import fr.xephi.authme.security.HashAlgorithm; +import fr.xephi.authme.settings.properties.DatabaseSettings; import fr.xephi.authme.settings.properties.PluginSettings; import fr.xephi.authme.settings.properties.RegistrationSettings; import fr.xephi.authme.settings.properties.SecuritySettings; @@ -74,6 +75,7 @@ public class SettingsMigrationService extends PlainMigrationService { | convertToRegistrationType(resource) | mergeAndMovePermissionGroupSettings(resource) | moveDeprecatedHashAlgorithmIntoLegacySection(resource) + | moveSaltColumnConfigWithOtherColumnConfigs(resource) || hasDeprecatedProperties(resource); } @@ -313,6 +315,18 @@ public class SettingsMigrationService extends PlainMigrationService { return false; } + /** + * Moves the property for the password salt column name to the same path as all other column name properties. + * + * @param resource The property resource + * @return True if the configuration has changed, false otherwise + */ + private static boolean moveSaltColumnConfigWithOtherColumnConfigs(PropertyResource resource) { + Property oldProperty = newProperty("ExternalBoardOptions.mySQLColumnSalt", + DatabaseSettings.MYSQL_COL_SALT.getDefaultValue()); + return moveProperty(oldProperty, DatabaseSettings.MYSQL_COL_SALT, resource); + } + /** * Retrieves the old config to run a command when alt accounts are detected and sets them to this instance * for further processing. diff --git a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java index 8ebccf941..0818c2693 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java @@ -65,7 +65,7 @@ public final class DatabaseSettings implements SettingsHolder { @Comment("Column for storing players passwords salts") public static final Property MYSQL_COL_SALT = - newProperty("ExternalBoardOptions.mySQLColumnSalt", ""); + newProperty("DataSource.mySQLColumnSalt", ""); @Comment("Column for storing players emails") public static final Property MYSQL_COL_EMAIL = diff --git a/src/test/java/fr/xephi/authme/settings/SettingsMigrationServiceTest.java b/src/test/java/fr/xephi/authme/settings/SettingsMigrationServiceTest.java index de53ec169..51cef1936 100644 --- a/src/test/java/fr/xephi/authme/settings/SettingsMigrationServiceTest.java +++ b/src/test/java/fr/xephi/authme/settings/SettingsMigrationServiceTest.java @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.List; import static fr.xephi.authme.TestHelper.getJarFile; +import static fr.xephi.authme.settings.properties.DatabaseSettings.MYSQL_COL_SALT; import static fr.xephi.authme.settings.properties.PluginSettings.ENABLE_PERMISSION_CHECK; import static fr.xephi.authme.settings.properties.PluginSettings.LOG_LEVEL; import static fr.xephi.authme.settings.properties.PluginSettings.REGISTERED_GROUP; @@ -128,6 +129,7 @@ public class SettingsMigrationServiceTest { assertThat(settings.getProperty(UNREGISTERED_GROUP), equalTo("")); assertThat(settings.getProperty(PASSWORD_HASH), equalTo(HashAlgorithm.SHA256)); assertThat(settings.getProperty(LEGACY_HASHES), contains(HashAlgorithm.PBKDF2, HashAlgorithm.WORDPRESS, HashAlgorithm.SHA512)); + assertThat(settings.getProperty(MYSQL_COL_SALT), equalTo("salt_col_name")); // Check migration of old setting to email.html assertThat(Files.readLines(new File(dataFolder, "email.html"), StandardCharsets.UTF_8), diff --git a/src/test/resources/fr/xephi/authme/settings/config-old.yml b/src/test/resources/fr/xephi/authme/settings/config-old.yml index 8c1dc7f3e..2e34180cb 100644 --- a/src/test/resources/fr/xephi/authme/settings/config-old.yml +++ b/src/test/resources/fr/xephi/authme/settings/config-old.yml @@ -275,7 +275,7 @@ settings: applyBlindEffect: false ExternalBoardOptions: # MySQL column for the salt , needed for some forum/cms support - mySQLColumnSalt: '' + mySQLColumnSalt: 'salt_col_name' # MySQL column for the group, needed for some forum/cms support mySQLColumnGroup: '' # -1 mean disabled. If u want that only