-
Notifications
You must be signed in to change notification settings - Fork 88
Description
Checklist
- I read Contribution Guidelines
- I searched the documentation to ensure that the requested feature is not already implemented and described
- I searched existing issues before opening this one
Is your feature request related to a problem? Please describe.
From what I read in the source code there are no specific exception when a signature had already been used. It just raise a BadSignature
:
https://github.com/apragacz/django-rest-registration/blob/master/rest_registration/utils/verification.py#L9
This is because the salt used is not the same after the account had been registered and from the comments this seems by design:
https://github.com/apragacz/django-rest-registration/blob/master/rest_registration/api/views/register.py#L46
The problem is it can lead to a bad user experience. For example, in our setup we have REGISTER_VERIFICATION_AUTO_LOGIN and REGISTER_VERIFICATION_ONE_TIME_USE enabled. If a user follows the verification link on a device, he got registered and logged in. Later on he follows the link on an other device and here we are only able to show a generic error message: "The link is invalid."
Describe the solution you'd like
- We would like a specific exception to be raised like
SignatureAlreadyUsed
OR - if there was a way to override the
verify_registration
endpoint we could first check if a user is verified and if not go on with the usual verification
In both cases this will allow us to display a relevant error message to our users like "You are already verified, please log in"
Describe alternatives you've considered
We tried to enable REGISTER_VERIFICATION_AUTO_LOGIN and disable REGISTER_VERIFICATION_ONE_TIME_USE but this leads to this error:
REGISTER_VERIFICATION_AUTO_LOGIN is enabled, but REGISTER_VERIFICATION_ONE_TIME_USE is not enabled. This can allow multiple logins using the verification url.
This is indeed not ideal for security.