diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index 12dcb90f47..b44d9f4e77 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -157,7 +157,8 @@ "name": "http_password", "label": "HTTP Password", "type": "password", - "help": "Password used for basic HTTP authentication. Leave this blank if you do not want to change it.", + "help": "Password used for basic HTTP authentication. Leave this alone if you do not want to change it.", + "default" : "password", "value-hidden": true }, { diff --git a/domain-server/src/DomainServer.cpp b/domain-server/src/DomainServer.cpp index 782c54419d..d637a20454 100644 --- a/domain-server/src/DomainServer.cpp +++ b/domain-server/src/DomainServer.cpp @@ -2114,10 +2114,10 @@ bool DomainServer::isAuthenticatedRequest(HTTPConnection* connection, const QUrl const QVariant* settingsPasswordVariant = valueForKeyPath(settingsMap, BASIC_AUTH_PASSWORD_KEY_PATH); QString settingsPassword = settingsPasswordVariant ? settingsPasswordVariant->toString() : ""; - QString hexHeaderPassword = QCryptographicHash::hash(headerPassword.toUtf8(), QCryptographicHash::Sha256).toHex(); - - if (settingsUsername == headerUsername - && (settingsPassword.isEmpty() || hexHeaderPassword == settingsPassword)) { + QString hexHeaderPassword = headerPassword.isEmpty() ? + "" : QCryptographicHash::hash(headerPassword.toUtf8(), QCryptographicHash::Sha256).toHex(); + + if (settingsUsername == headerUsername && hexHeaderPassword == settingsPassword) { return true; } }