Skip to content

Avoid IntegrityError on duplicate logins or emails

Remi Rampin requested to merge integrityerror into master

Hashing the password can take some time, during which it is possible the user will submit the form again to register or change their email address. This causes an IntegrityError which was also not caught.

This prevents forms from being re-submitted on the client side (disable the button), which should remove some benign but common duplicate errors (client conflicting with themselves). It also reorders the password hashing which limits the chance of a duplicate appearing between the check and the database commit. Finally it catches the IntegrityError exception if it does occur.

Merge request reports