def METHOD_NAME(request):
    user = request.couch_user
    invites = Invitation.by_email(user.username)
    for invitation in invites:
        if not invitation.is_expired:
            invitation.accept_invitation_and_join_domain(user)
            messages.success(request, _(f'You have been added to the "{invitation.domain}" project space.'))
    return HttpResponseRedirect(reverse('domain_select_redirect'))