Password reset functionality, ZWave switch schedule improvement, support zwave controller on pi, support relay switches and security sensors.

This commit is contained in:
MarkBryanMilligan
2021-07-02 12:06:37 -05:00
parent 6c2b567536
commit de50645a2c
65 changed files with 27104 additions and 438 deletions

View File

@@ -32,6 +32,9 @@ public interface CurrentMonitorDao {
void updateSummaries(BreakerGroup _rootGroup, Set<Date> _daysToSummarize, TimeZone _tz);
String addPasswordResetKey(String _email);
String getEmailForResetKey(String _key);
boolean resetPassword(String _key, String _password);
String authenticateAccount(String _username, String _password);
String getAuthCodeForEmail(String _email, TimeZone _tz);
Account authCodeToAccount(String _authCode);

View File

@@ -296,6 +296,32 @@ public class MongoCurrentMonitorDao implements CurrentMonitorDao {
return _account;
}
@Override
public String addPasswordResetKey(String _email) {
String key = aes.encryptToBase64(_email);
proxy.saveEntity("password_reset", new DaoEntity("_id", key));
return key;
}
@Override
public String getEmailForResetKey(String _key) {
DaoEntity entity = proxy.queryForEntity("password_reset", new DaoQuery("_id", _key));
if (entity == null)
return null;
return aes.decryptFromBase64ToString(_key);
}
@Override
public boolean resetPassword(String _key, String _password) {
DaoEntity entity = proxy.queryForEntity("password_reset", new DaoQuery("_id", _key));
if (entity == null)
return false;
Account acct = getAccountByUsername(aes.decryptFromBase64ToString(_key));
acct.setPassword(_password);
putAccount(acct);
return true;
}
@Override
public MongoProxy getProxy() {
return proxy;