Show clearer behavior when no email confirmation is needed after all

This commit is contained in:
Mouse Reeve 2022-04-26 08:09:38 -07:00
parent 34be995125
commit a6cb46356f

View file

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