def get_email_confirmation_url()

in pulseapi/users/adapter.py [0:0]


    def get_email_confirmation_url(self, request, emailconfirmation):
        """
        Override this so that we can set the `?next=` url in the email
        confirmation url so that the user is redirected correctly after
        confirming their email.

        FIXME: This currently does not work because no `?next=` parameter
        is passed to the email confirmation view. Our current workaround
        for this is to set the
        `ACCOUNT_EMAIL_CONFIRMATION_AUTHENTICATED_REDIRECT_URL` to be
        the pulse front-end url via an environment veriable on production.
        """
        url = super().get_email_confirmation_url(request, emailconfirmation)
        next_url = request.GET.get('next')

        if not (next_url and self.is_safe_url(next_url)):
            return url

        # Parse the url and add the `next` url to it as a query string
        url_parts = list(urlparse(url))
        qs = dict(parse_qsl(url_parts[4]))
        qs.update({'next': next_url})
        url_parts[4] = urlencode(qs)

        return urlunparse(url_parts)