- Introduce /email code

- Add max tries for /email code
- Introduce a PasswordRecoveryService
This commit is contained in:
EbonJaguar
2017-03-06 13:54:46 -05:00
parent a64f758ee9
commit 7d4bfcd99d
40 changed files with 529 additions and 240 deletions
@@ -35,6 +35,21 @@ public class TimedCounter<K> extends ExpiringMap<K, Integer> {
put(key, get(key) + 1);
}
/**
* Decrements the value stored for the provided key.
* This method will NOT update the expiration.
*
* @param key the key to increment the counter for
*/
public void decrement(K key) {
ExpiringEntry<Integer> e = entries.get(key);
if (e != null) {
if (e.getValue() <= 0) { remove(key); }
else {entries.put(key, new ExpiringEntry<>(e.getValue() - 1, e.getExpiration())); }
}
}
/**
* Calculates the total of all non-expired entries in this counter.
*