summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Spielmann <martin.spielmann@pingunaut.com>2017-01-07 13:53:36 +0100
committerMartin Spielmann <martin.spielmann@pingunaut.com>2017-01-07 13:53:36 +0100
commita4fef5ae34225f9f3d1fee4c0757466d3a3fb4d7 (patch)
tree0e2533522e3e3ea233daeb9bf1514aaaba8baedb /src
parent4ab81b3465f086f9fbeadc93d6bce326208e85ac (diff)
downloadgitblit-a4fef5ae34225f9f3d1fee4c0757466d3a3fb4d7.tar.gz
gitblit-a4fef5ae34225f9f3d1fee4c0757466d3a3fb4d7.zip
Replaced duplicated strings by using constant
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/gitblit/client/EditUserDialog.java4
-rw-r--r--src/main/java/com/gitblit/wicket/pages/ChangePasswordPage.java4
2 files changed, 4 insertions, 4 deletions
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);
}