Skip to content

Commit b8ad675

Browse files
committed
2 parents 4db8db0 + e8ac9f6 commit b8ad675

File tree

2 files changed

+36
-22
lines changed

2 files changed

+36
-22
lines changed

main/WebServer.cpp

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -810,10 +810,17 @@ namespace http {
810810
usrname = base64_decode(usrname);
811811
int iUser = -1;
812812
iUser = FindUser(usrname.c_str());
813-
if (iUser == -1)
813+
if (iUser == -1) {
814+
// log brute force attack
815+
_log.Log(LOG_ERROR, "Failed login attempt for '%s' !", usrname.c_str());
814816
return;
815-
if (m_users[iUser].Password != usrpass)
817+
}
818+
if (m_users[iUser].Password != usrpass) {
819+
// log brute force attack
820+
_log.Log(LOG_ERROR, "Failed login attempt for '%s' !", m_users[iUser].Username.c_str());
816821
return;
822+
}
823+
_log.Log(LOG_STATUS, "Login successfull : user '%s'", m_users[iUser].Username.c_str());
817824
root["status"] = "OK";
818825
root["title"] = "logincheck";
819826
m_pWebEm->m_actualuser = m_users[iUser].Username;
@@ -11594,6 +11601,16 @@ namespace http {
1159411601
method = atoi(sMethod.c_str());
1159511602
if (bHaveUsage == false)
1159611603
method = 0;
11604+
11605+
// Force Value graph even if device should show Value graph
11606+
if ((method == 1) && (
11607+
((dType == pTypeENERGY) && ((dSubType == sTypeELEC2) || (dSubType == sTypeELEC3))) ||
11608+
((dType == pTypeGeneral) && (dSubType == sTypeKwh))
11609+
)) {
11610+
//_log.Log(LOG_ERROR, "Energy/CMxxx or General/kWh device graph method should be 0!");
11611+
method = 0;
11612+
}
11613+
1159711614
if (method != 0)
1159811615
{
1159911616
//realtime graph
@@ -11635,27 +11652,24 @@ namespace http {
1163511652
}
1163611653
ulFirstRealValue = ulLastValue;
1163711654
float TotalValue = float(ulTotalValue);
11638-
if (TotalValue != 0)
11655+
switch (metertype)
1163911656
{
11640-
switch (metertype)
11641-
{
11642-
case MTYPE_ENERGY:
11643-
case MTYPE_ENERGY_GENERATED:
11644-
sprintf(szTmp, "%.3f", (TotalValue / EnergyDivider)*1000.0f); //from kWh -> Watt
11645-
break;
11646-
case MTYPE_GAS:
11647-
sprintf(szTmp, "%.2f", TotalValue / GasDivider);
11648-
break;
11649-
case MTYPE_WATER:
11650-
sprintf(szTmp, "%.3f", TotalValue / WaterDivider);
11651-
break;
11652-
case MTYPE_COUNTER:
11653-
sprintf(szTmp, "%.1f", TotalValue);
11654-
break;
11655-
}
11656-
root["result"][ii]["v"] = szTmp;
11657-
ii++;
11657+
case MTYPE_ENERGY:
11658+
case MTYPE_ENERGY_GENERATED:
11659+
sprintf(szTmp, "%.3f", (TotalValue / EnergyDivider)*1000.0f); //from kWh -> Watt
11660+
break;
11661+
case MTYPE_GAS:
11662+
sprintf(szTmp, "%.2f", TotalValue / GasDivider);
11663+
break;
11664+
case MTYPE_WATER:
11665+
sprintf(szTmp, "%.3f", TotalValue / WaterDivider);
11666+
break;
11667+
case MTYPE_COUNTER:
11668+
sprintf(szTmp, "%.1f", TotalValue);
11669+
break;
1165811670
}
11671+
root["result"][ii]["v"] = szTmp;
11672+
ii++;
1165911673
}
1166011674
LastDateTime = actDateTimeHour;
1166111675
bHaveFirstValue = false;

notifications/NotificationProwl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ bool CNotificationProwl::SendMessageImplementation(const std::string &Subject, c
2424
bRet = HTTPClient::POST("https://api.prowlapp.com/publicapi/add",sPostData.str(),ExtraHeaders,sResult);
2525
bool bSuccess = (sResult.find("success code=\"200\"") != std::string::npos);
2626
if (!bSuccess)
27-
_log.Log(LOG_ERROR, "NMA: %s", sResult.c_str());
27+
_log.Log(LOG_ERROR, "Prowl: %s", sResult.c_str());
2828
return (bRet && bSuccess);
2929
}
3030

0 commit comments

Comments
 (0)