From: Martin Spielmann Date: Sat, 7 Jan 2017 12:53:36 +0000 (+0100) Subject: Replaced duplicated strings by using constant X-Git-Tag: r1.9.0~35^2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a4fef5ae34225f9f3d1fee4c0757466d3a3fb4d7;p=gitblit.git Replaced duplicated strings by using constant --- diff --git a/src/main/java/com/gitblit/client/EditUserDialog.java b/src/main/java/com/gitblit/client/EditUserDialog.java index fcbb41ef..141f233b 100644 --- a/src/main/java/com/gitblit/client/EditUserDialog.java +++ b/src/main/java/com/gitblit/client/EditUserDialog.java @@ -335,7 +335,7 @@ public class EditUserDialog extends JDialog { // change the cookie user.cookie = user.createCookie(); - String type = settings.get(Keys.realm.passwordStorage).getString("PBKDF2WithHmacSHA256"); + String type = settings.get(Keys.realm.passwordStorage).getString(SecurePasswordHashUtils.PBKDF2WITHHMACSHA256); if (type.equalsIgnoreCase("md5")) { // store MD5 digest of password user.password = StringUtils.MD5_TYPE + StringUtils.getMD5(password); @@ -343,7 +343,7 @@ public class EditUserDialog extends JDialog { // store MD5 digest of username+password user.password = StringUtils.COMBINED_MD5_TYPE + StringUtils.getMD5(user.username + password); - } else if (type.equalsIgnoreCase("PBKDF2WithHmacSHA256")) { + } else if (type.equalsIgnoreCase(SecurePasswordHashUtils.PBKDF2WITHHMACSHA256)) { // store PBKDF2WithHmacSHA256 digest of password user.password = SecurePasswordHashUtils.get().createStoredPasswordFromPassword(password); } else { diff --git a/src/main/java/com/gitblit/wicket/pages/ChangePasswordPage.java b/src/main/java/com/gitblit/wicket/pages/ChangePasswordPage.java index afc4058b..4c074abc 100644 --- a/src/main/java/com/gitblit/wicket/pages/ChangePasswordPage.java +++ b/src/main/java/com/gitblit/wicket/pages/ChangePasswordPage.java @@ -87,7 +87,7 @@ public class ChangePasswordPage extends RootSubPage { UserModel user = GitBlitWebSession.get().getUser(); // convert to MD5 digest, if appropriate - String type = app().settings().getString(Keys.realm.passwordStorage, "PBKDF2WithHmacSHA256"); + String type = app().settings().getString(Keys.realm.passwordStorage, SecurePasswordHashUtils.PBKDF2WITHHMACSHA256); if (type.equalsIgnoreCase("md5")) { // store MD5 digest of password password = StringUtils.MD5_TYPE + StringUtils.getMD5(password); @@ -95,7 +95,7 @@ public class ChangePasswordPage extends RootSubPage { // store MD5 digest of username+password password = StringUtils.COMBINED_MD5_TYPE + StringUtils.getMD5(user.username.toLowerCase() + password); - } else if (type.equalsIgnoreCase("PBKDF2WithHmacSHA256")) { + } else if (type.equalsIgnoreCase(SecurePasswordHashUtils.PBKDF2WITHHMACSHA256)) { // store PBKDF2WithHmacSHA256 digest of password user.password = SecurePasswordHashUtils.get().createStoredPasswordFromPassword(password); }