Only allow latest activation code to be used (#2160)

(cherry picked from commit dd09297bead4ea27731ac3bd60fcf2a3e7001268)
This commit is contained in:
Adrià Casajús 2024-07-23 16:23:37 +02:00 committed by GitHub
parent a7aec0c37a
commit 1407c969d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -115,7 +115,8 @@ def register():
def send_activation_email(user, next_url): def send_activation_email(user, next_url):
# the activation code is valid for 1h # the activation code is valid for 1h and delete all previous codes
Session.query(ActivationCode).filter(ActivationCode.user_id == user.id).delete()
activation = ActivationCode.create(user_id=user.id, code=random_string(30)) activation = ActivationCode.create(user_id=user.id, code=random_string(30))
Session.commit() Session.commit()