Don’t re-expire old keys

If a key has already been expired we don’t want to lose the information
about when that happened by giving it a new expiry date.
This commit is contained in:
Chris Hill-Scott
2021-07-30 11:56:51 +01:00
parent 43bcb56ff4
commit 132411be24
2 changed files with 16 additions and 4 deletions

View File

@@ -70,7 +70,8 @@ def set_broadcast_service_type(service, service_mode, broadcast_channel, provide
# Revoke any API keys to avoid a regular API key being used to send alerts
ApiKey.query.filter_by(
service_id=service.id
service_id=service.id,
expiry_date=None,
).update({
ApiKey.expiry_date: datetime.utcnow()
})