mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Add option to disable HIBP password check.
Usage of this option is discouraged for password security reason.
This commit is contained in:
parent
59bdec9d33
commit
a1a3e717b2
3 changed files with 7 additions and 1 deletions
|
@ -20,6 +20,9 @@ API_URL: https://pipedapi.kavin.rocks
|
||||||
# Public Frontend URL
|
# Public Frontend URL
|
||||||
FRONTEND_URL: https://piped.kavin.rocks
|
FRONTEND_URL: https://piped.kavin.rocks
|
||||||
|
|
||||||
|
# Enable haveibeenpwned compromised password API
|
||||||
|
COMPROMISED_PASSWORD_CHECK: true
|
||||||
|
|
||||||
# Hibernate properties
|
# Hibernate properties
|
||||||
hibernate.connection.url: jdbc:postgresql://postgres:5432/piped
|
hibernate.connection.url: jdbc:postgresql://postgres:5432/piped
|
||||||
hibernate.connection.driver_class: org.postgresql.Driver
|
hibernate.connection.driver_class: org.postgresql.Driver
|
||||||
|
|
|
@ -41,6 +41,8 @@ public class Constants {
|
||||||
public static final HttpClient h2client;
|
public static final HttpClient h2client;
|
||||||
public static final HttpClient h2_no_redir_client;
|
public static final HttpClient h2_no_redir_client;
|
||||||
|
|
||||||
|
public static final boolean COMPROMISED_PASSWORD_CHECK;
|
||||||
|
|
||||||
public static final ObjectMapper mapper = new ObjectMapper().addMixIn(Page.class, PageMixin.class);
|
public static final ObjectMapper mapper = new ObjectMapper().addMixIn(Page.class, PageMixin.class);
|
||||||
|
|
||||||
public static final Object2ObjectOpenHashMap<String, String> hibernateProperties = new Object2ObjectOpenHashMap<>();
|
public static final Object2ObjectOpenHashMap<String, String> hibernateProperties = new Object2ObjectOpenHashMap<>();
|
||||||
|
@ -59,6 +61,7 @@ public class Constants {
|
||||||
PUBLIC_URL = prop.getProperty("API_URL");
|
PUBLIC_URL = prop.getProperty("API_URL");
|
||||||
HTTP_PROXY = prop.getProperty("HTTP_PROXY");
|
HTTP_PROXY = prop.getProperty("HTTP_PROXY");
|
||||||
FRONTEND_URL = prop.getProperty("FRONTEND_URL", "https://pipedapi.kavin.rocks");
|
FRONTEND_URL = prop.getProperty("FRONTEND_URL", "https://pipedapi.kavin.rocks");
|
||||||
|
COMPROMISED_PASSWORD_CHECK = Boolean.parseBoolean(prop.getProperty("COMPROMISED_PASSWORD_CHECK", "true"));
|
||||||
prop.forEach((_key, _value) -> {
|
prop.forEach((_key, _value) -> {
|
||||||
String key = String.valueOf(_key), value = String.valueOf(_value);
|
String key = String.valueOf(_key), value = String.valueOf(_value);
|
||||||
if (key.startsWith("hibernate"))
|
if (key.startsWith("hibernate"))
|
||||||
|
|
|
@ -536,7 +536,7 @@ public class ResponseHelper {
|
||||||
return Constants.mapper.writeValueAsBytes(new AlreadyRegisteredResponse());
|
return Constants.mapper.writeValueAsBytes(new AlreadyRegisteredResponse());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
if (Constants.COMPROMISED_PASSWORD_CHECK) {
|
||||||
String sha1Hash = DigestUtils.sha1Hex(pass).toUpperCase();
|
String sha1Hash = DigestUtils.sha1Hex(pass).toUpperCase();
|
||||||
String prefix = sha1Hash.substring(0, 5);
|
String prefix = sha1Hash.substring(0, 5);
|
||||||
String suffix = sha1Hash.substring(5);
|
String suffix = sha1Hash.substring(5);
|
||||||
|
|
Loading…
Reference in a new issue