Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ResendEmailVerificationView requires queryset #309

Closed
wants to merge 3 commits into from
Closed

ResendEmailVerificationView requires queryset #309

wants to merge 3 commits into from

Conversation

aladagemre
Copy link

@aladagemre aladagemre commented Sep 18, 2021

#44 (comment)

Problems

  • When POSTed email to ResendemailVerificationView, we get 'ResendEmailVerificationView' should either include a queryset attribute, or override the get_queryset() method. error.
  • When the email POSTed does not exist in the system, EmailAddress.DoesNotExist exception is raised.

Solution

  • ResendEmailVerificationView requires queryset attribute since it extends CreateAPIView
  • ResendEmailVerificationView uses filter().first() to avoid exception in cases email does not exist in the database. EmailAddress.objects.get() raises exception, instead of returning False.
  • Don't expose that the email exists and already verified or it does not exist in the system. Avoid leaks like we do in password reset.
  • Add tests to check we only send e-mail when needed: email exists and not verified. In other cases no email sent but the response is 200.

#44 (comment)

## Problems
* When POSTed `email` to ResendemailVerificationView, we get `'ResendEmailVerificationView' should either include a queryset attribute, or override the get_queryset() method.` error.
* When the email POSTed does not exist in the system, `EmailAddress.DoesNotExist` exception is raised.

## Solution

* `ResendEmailVerificationView` requires `queryset` attribute since it extends `CreateAPIView`
* `ResendEmailVerificationView` requires exception handling in cases email does not exist in the database. `EmailAddress.objects.get()` raises exception, instead of returning `False`.
@aladagemre
Copy link
Author

I see the changes are fixed, closing the PR.

@aladagemre aladagemre closed this Feb 27, 2022
@aladagemre aladagemre deleted the patch-1 branch February 27, 2022 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant