mirror of
https://github.com/zyphlar/LanternPowerMonitor.git
synced 2024-03-08 14:07:47 +00:00
Added a case for the Zero 2 W.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+13
-3
@@ -302,6 +302,8 @@ public class MongoCurrentMonitorDao implements CurrentMonitorDao {
|
|||||||
@Override
|
@Override
|
||||||
public void rebuildSummaries(int _accountId, Date _start, Date _end) {
|
public void rebuildSummaries(int _accountId, Date _start, Date _end) {
|
||||||
BreakerConfig config = getConfig(_accountId);
|
BreakerConfig config = getConfig(_accountId);
|
||||||
|
if (config == null)
|
||||||
|
return;
|
||||||
TimeZone tz = getTimeZoneForAccount(_accountId);
|
TimeZone tz = getTimeZoneForAccount(_accountId);
|
||||||
Date start = DateUtils.getMidnightBefore(_start, tz);
|
Date start = DateUtils.getMidnightBefore(_start, tz);
|
||||||
BreakerGroup root = CollectionUtils.getFirst(config.getBreakerGroups());
|
BreakerGroup root = CollectionUtils.getFirst(config.getBreakerGroups());
|
||||||
@@ -397,8 +399,14 @@ public class MongoCurrentMonitorDao implements CurrentMonitorDao {
|
|||||||
public BreakerConfig getMergedConfig(AuthCode _authCode) {
|
public BreakerConfig getMergedConfig(AuthCode _authCode) {
|
||||||
if (_authCode == null)
|
if (_authCode == null)
|
||||||
return null;
|
return null;
|
||||||
if (CollectionUtils.size(_authCode.getAllAccountIds()) == 1)
|
if (CollectionUtils.size(_authCode.getAllAccountIds()) == 1) {
|
||||||
return getConfig(_authCode.getAccountId());
|
BreakerConfig config = getConfig(_authCode.getAccountId());
|
||||||
|
if (config == null) {
|
||||||
|
config = new BreakerConfig();
|
||||||
|
config.setAccountId(_authCode.getAccountId());
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
List<BreakerConfig> configs = CollectionUtils.transform(_authCode.getAllAccountIds(), this::getConfig, true);
|
List<BreakerConfig> configs = CollectionUtils.transform(_authCode.getAllAccountIds(), this::getConfig, true);
|
||||||
BreakerConfig config = new BreakerConfig();
|
BreakerConfig config = new BreakerConfig();
|
||||||
config.setAccountId(_authCode.getAccountId());
|
config.setAccountId(_authCode.getAccountId());
|
||||||
@@ -438,7 +446,9 @@ public class MongoCurrentMonitorDao implements CurrentMonitorDao {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String authenticateAccount(String _username, String _password) {
|
public String authenticateAccount(String _username, String _password) {
|
||||||
Account acct = proxy.queryOne(Account.class, new DaoQuery("username", _username));
|
if (NullUtils.isEmpty(_username) || NullUtils.isEmpty(_password))
|
||||||
|
return null;
|
||||||
|
Account acct = proxy.queryOne(Account.class, new DaoQuery("username", _username.toLowerCase().trim()));
|
||||||
if ((acct == null) || !BCrypt.checkpw(_password, acct.getPassword()))
|
if ((acct == null) || !BCrypt.checkpw(_password, acct.getPassword()))
|
||||||
return null;
|
return null;
|
||||||
return toAuthCode(acct.getId(), acct.getAuxiliaryAccountIds());
|
return toAuthCode(acct.getId(), acct.getAuxiliaryAccountIds());
|
||||||
|
|||||||
Reference in New Issue
Block a user