Python 如何在iframe中运行django-allauth流并在流结束时关闭它?

Python 如何在iframe中运行django-allauth流并在流结束时关闭它?,python,django,iframe,url-redirection,django-allauth,Python,Django,Iframe,Url Redirection,Django Allauth,我正在使用django allauth(版本0.21.0、django 1.8、python 3.4) 我遇到的问题是,我的allauth流/屏幕显示在iframe中(这是设计师决定的:)) 我有两个相互关联的问题: 一,。 当用户成功完成登录/注册时,通过响应的重定向url就是登录页(localhost:8080),这就是iframe上显示的内容 我想刷新该案例的iframe父窗口。 为此,我编辑了utils.py (my_virtual_env\Lib\site packages\all

我正在使用django allauth(版本0.21.0、django 1.8、python 3.4)

我遇到的问题是,我的allauth流/屏幕显示在iframe中(这是设计师决定的:))

我有两个相互关联的问题:

一,。 当用户成功完成登录/注册时,通过响应的重定向url就是登录页(localhost:8080),这就是iframe上显示的内容

我想刷新该案例的iframe父窗口。 为此,我编辑了utils.py (my_virtual_env\Lib\site packages\allauth\account\utils.py)

在执行登录功能时:

def perform_login(request, user, email_verification,
                  redirect_url=None, signal_kwargs=None,
                  signup=False):
[…]
    try:
        get_adapter().login(request, user)
        response = HttpResponseRedirect(get_login_redirect_url(request, redirect_url))
[…]
    return response
我换了

response = HttpResponseRedirect(get_login_redirect_url(request, redirect_url))

但是由于我将HttpResponseRedirect更改为HttpResponse(在utils.py上),因此成功注册后弹出url不会更改,并且我没有指示何时关闭弹出窗口

我真的希望你能以一种体面的方式处理这种情况

response = HttpResponse('<script type="text/javascript">parent.refreshLanding();</script>')
setInterval(function () {
    if (popupWindow.location.href.indexOf("http://localhost:8000/accounts/google/login/callback/") === 0) {
        popupWindow.close();
        window.parent.location = window.parent.location;
    }
}, 1);