Add a validator to the /admin/ form for changing email addresses
authorMagnus Hagander <magnus@hagander.net>
Fri, 29 Jan 2021 10:17:14 +0000 (11:17 +0100)
committerMagnus Hagander <magnus@hagander.net>
Fri, 29 Jan 2021 10:17:14 +0000 (11:17 +0100)
commitc0e8e71040b95bb7fbf5b4aa3fb62e50d4478013
treecd5aec64fce8959346fe926e06f4e1aeaef313a9
parent218a8c665c5b26a17752bda4bbc488dcf9026b31
Add a validator to the /admin/ form for changing email addresses

As Jonathan recently demonstrated, it was possible to change the primary
email address on one account to be the secondary email address of
another one when using /admin/ (it was prevented when using the user
facing forms), which then caused conflicts in the change track and
replication steps later.

Add a validator to the admin form to avoid this mistake in the future.

This doesn't entirely remove all possibilities, so we should consider
adding a database trigger to enforce it as well, but it closes the most
obvious hole and makes the other ones much harder to hit (but you can
still cause the same damage through psql or so, of course).
pgweb/account/admin.py