1
所有人。我開始與Django合作。當我搜索身份驗證系統時,我發現了django-allauth軟件包。這很好,但是我嘗試自定義社交註冊表單時遇到問題,我想讓用戶在當時註冊用戶時輸入密碼,並且他們必須在註冊時填寫。作爲我編寫自定義表單的文檔。Django-allauth自定義社交註冊表格
class SocialSignupForm(forms.Form):
password1 = forms.CharField(max_length=30, label="Password")
password2 = forms.CharField(max_length=30, label="Password(again)")
def clean_password1(self):
if ("password1" in self.cleaned_data and "password2" in self.cleaned_data):
if self.cleaned_data['password1'] != self.cleaned_data['password2']:
raise forms.ValidationError(_("You must type the same password"
" each time."))
return self.cleaned_data["password1"]
def signup(self, request, user):
user.set_password(self.cleaned_data["password1"])
user.save()
,並設置文件我把
ACCOUNT_AUTHENTICATION_METHOD = "email"
ACCOUNT_UNIQUE_EMAIL = True
ACCOUNT_USERNAME_REQUIRED = True
ACCOUNT_EMAIL_REQUIRED = True
SOCIALACCOUNT_AUTO_SIGNUP = True
SOCIALACCOUNT_QUERY_EMAIL = True
SOCIALACCOUNT_PROVIDERS = {
'facebook': {
'SCOPE': ['email', 'publish_stream'],
'METHOD': 'oauth2'
}
}
ACCOUNT_ADAPTER = 'myapp.adapter.MyAccountAdapter'
SOCIALACCOUNT_ADAPTER = 'myapp.adapter.MySocialAccountAdapter'
ACCOUNT_SIGNUP_FORM_CLASS = 'myapp.forms.SignupForm'
SOCIALACCOUNT_FORMS = {'signup': 'myapp.forms.SocialSignupForm'}
,但是當我嘗試連接到社會提供商,我收到:
初始化()得到了一個意想不到的關鍵字參數「 sociallogin'
any c建議我如何解決這個問題
請添加回溯哪裏出現錯誤。 – 2014-10-08 09:38:10
這是回溯,你能幫我嗎:(https://www.evernote.com/shard/s201/sh/90dcd99e-9469-4f7d-ab5c-f5fa78363f86/11424116d3a0646750495ddcf5689be5 – 2014-10-09 12:30:03