2015-05-06 31 views
2

我想用python-social-auth添加電子郵件驗證。social.actions.do_complete不能在python-social-auth中工作

Documentation說:

Form submit should go to /complete/email, or if it goes to your view, then your view should complete the process calling social.actions.do_complete

在我的情況下,形式去我自己的觀點,並在年底我應該叫do_complete。我搜索了很多,但無法找到關於此方法的任何文檔。我看了看源代碼和定義是:

def do_complete(backend, login, user=None, redirect_name='next', 
      *args, **kwargs) 

但是我怎麼給該方法的所有這些參數,即後端,登錄(什麼是登錄?),並從等我的Django的看法?

回答

0

你可以做的是手動加載你的後臺是這樣的:

from social.apps.django_app.utils import load_strategy, load_backend 
strategy = load_strategy(self.request) 
backend = load_backend(strategy, 'username', "social:complete") 

其中username是後端的名稱,然後調用do_complete這樣的:這裏是事先得到backend

do_complete(backend, login, user) 

後端,login是一個登錄功能(從social.apps.django_app.views查看_do_login功能)和user是您的用戶實例,您已創建/認證在你看來,這是經過驗證的。 希望這可以幫助未來的人

相關問題