chg: further replaced helma’s md5 implementation with apache commons codec

This commit is contained in:
Tobi Schäfer 2020-03-21 13:26:39 +01:00
parent be233eba03
commit 39f565252f
4 changed files with 6 additions and 6 deletions

Binary file not shown.

View file

@ -49,7 +49,7 @@ helma.auth = function(realm) {
var accessAllowed = true;
if (req.data.username && req.data.password) {
if (pw && hostIsAllowed()) {
if (pw == Packages.helma.util.MD5Encoder.encode(req.data.username + "-" + req.data.password)) {
if (pw == Packages.org.apache.commons.codec.digest.DigestUtils.md5Hex(req.data.username + "-" + req.data.password)) {
session.data[realm+'Authenticated'] = true;
res.redirect(res.data.href);
} else {
@ -61,7 +61,7 @@ helma.auth = function(realm) {
The adminAccess property is not set.<br />\
Before proceeding, add the following line to your app.properties or server.properties file:\
<br /><br />adminAccess='
+ Packages.helma.util.MD5Encoder.encode(req.data.username + "-" + req.data.password);
+ Packages.org.apache.commons.codec.digest.DigestUtils.md5Hex(req.data.username + "-" + req.data.password);
else param.message += 'The '+ realm +'AccessAllowed property does not match your host.<br />\
Before proceeding, remove this property from your app.properties or server.properties file \
or include your host as follows:<br /><br />'

View file

@ -46,7 +46,7 @@ function createAddressFilter() {
}
/**
/**
* updates the stats in app.data.stat every 5 minutes
*/
function appStat() {
@ -123,7 +123,7 @@ function checkAuth(appObj) {
if (uname == null || uname == "" || pwd == null || pwd == "")
return forceAuth();
var md5key = Packages.helma.util.MD5Encoder.encode(uname + "-" + pwd);
var md5key = Packages.org.apache.commons.codec.digest.DigestUtils.md5Hex(uname + "-" + pwd);
if (md5key == adminAccess)
return true;

View file

@ -75,7 +75,7 @@ function makekey_action() {
res.data.body = renderSkinAsString("pwdform", obj);
} else {
// render the md5-string:
obj.propsString = "adminAccess=" + Packages.helma.util.MD5Encoder.encode(req.data.username + "-" + req.data.password) + "<br>\n";
obj.propsString = "adminAccess=" + Packages.org.apache.commons.codec.digest.DigestUtils.md5Hex(req.data.username + "-" + req.data.password) + "<br>\n";
res.data.body = renderSkinAsString("pwdfeedback", obj);
}
@ -127,4 +127,4 @@ function mrtg_action() {
} else {
res.write("0\n0\n0\n0\n");
}
}
}