File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -55,12 +55,18 @@ def unique_username(node, value):
55
55
if user : # pragma: no cover
56
56
raise exc
57
57
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.
58
63
if request .db .scalars (
59
- select (models .UserDeletion .id )
60
- .where (
64
+ select (models .UserDeletion .id ).where (
61
65
models .UserDeletion .userid
62
66
== format_userid (value , request .default_authority )
63
67
)
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.
64
70
.where (models .UserDeletion .requested_at > datetime .now () - timedelta (days = 31 ))
65
71
).first ():
66
72
raise exc
You can’t perform that action at this time.
0 commit comments