Skip to content

Commit bde2da9

Browse files
committed
Add a couple of code comments
1 parent 3923a3d commit bde2da9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

h/accounts/schemas.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,18 @@ def unique_username(node, value):
5555
if user: # pragma: no cover
5656
raise exc
5757

58+
# Don't allow recently-deleted usernames to be re-used.
59+
# This is to make sure that there's time for the user's data to be expunged
60+
# from all systems (for example: Elasticsearch) before we allow a new
61+
# account with the same username to be registered.
62+
# Otherwise new accounts could inherit dating belonging to deleted accounts.
5863
if request.db.scalars(
59-
select(models.UserDeletion.id)
60-
.where(
64+
select(models.UserDeletion.id).where(
6165
models.UserDeletion.userid
6266
== format_userid(value, request.default_authority)
6367
)
68+
# 31 days is an arbitrary time delta that should be more than enough
69+
# time for all the previous user's data to be expunged.
6470
.where(models.UserDeletion.requested_at > datetime.now() - timedelta(days=31))
6571
).first():
6672
raise exc

0 commit comments

Comments
 (0)