Merge pull request #2089 from bookwyrm-social/no-confirmation

Show clearer behavior when no email confirmation is needed after all
This commit is contained in:
Mouse Reeve 2022-04-26 08:24:35 -07:00 committed by GitHub
commit 708dc4d613
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,9 +91,12 @@ class ConfirmEmailCode(View):
def get(self, request, code): # pylint: disable=unused-argument
"""you got the code! good work"""
settings = models.SiteSettings.get()
if request.user.is_authenticated or not settings.require_confirm_email:
if request.user.is_authenticated:
return redirect("/")
if not settings.require_confirm_email:
return redirect("login")
# look up the user associated with this code
try:
user = models.User.objects.get(confirmation_code=code)