我已经用django allauth和django1.10编写了自己的自定义帐户适配器,这样我就可以为要验证的密码指定一个regex模式。在
这是我的代码片段:
class MyAccountAdapter(DefaultAccountAdapter):
def clean_password(self, password):
if re.match(settings.ACCOUNT_PASSWORD_REGEX, password):
return password
else:
raise ValidationError("Password must be at least 8 characters long, contain one digit and one captalised alphabet")
我已经在我的设置.py:
ACCOUNT_ADAPTER = 'app.adapters.MyAccountAdapter'
当我试图注册(即提交一份填妥的表格)时,我收到以下错误:
TypeError at /accounts/signup/
clean_password() got an unexpected keyword argument 'user'
回溯:
^{pr2}$这个神秘的错误是什么意思,我该如何修复它?在
看看
DefaultAccountAdapter
的clean_password
实现:缺少
user
关键字参数。在相关问题 更多 >
编程相关推荐