mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-28 19:56:39 +00:00
feat(tokens-repo): recovery key uses decrement
This commit is contained in:
parent
eba1d01b3d
commit
13e84e2697
|
@ -90,7 +90,10 @@ class RedisTokensRepository(AbstractTokensRepository):
|
||||||
|
|
||||||
def _decrement_recovery_token(self):
|
def _decrement_recovery_token(self):
|
||||||
"""Decrement recovery key use count by one"""
|
"""Decrement recovery key use count by one"""
|
||||||
raise NotImplementedError
|
if self.is_recovery_key_valid():
|
||||||
|
uses_left = self.get_recovery_key().uses_left
|
||||||
|
r = self.connection
|
||||||
|
r.hset(RECOVERY_KEY_REDIS_KEY, "uses_left", uses_left - 1)
|
||||||
|
|
||||||
def _get_stored_new_device_key(self) -> Optional[NewDeviceKey]:
|
def _get_stored_new_device_key(self) -> Optional[NewDeviceKey]:
|
||||||
"""Retrieves new device key that is already stored."""
|
"""Retrieves new device key that is already stored."""
|
||||||
|
|
Loading…
Reference in a new issue