django 内置的密码重置视图是否可以与从 AbstractBaseUser 继承的自定义用户一起使用?
Will the django built in password reset views work with a custom user that inherits from AbstractBaseUser?
我打算构建一个自定义 Django 用户和一个自定义登录和注册视图,我想知道我是否也应该构建一个自定义密码重置视图。
If you’re entirely happy with Django’s User model, but you want to add some additional profile information, you could subclass django.contrib.auth.models.AbstractUser
and add your custom profile fields
这意味着AbstractUser
将继承所有可以应用于User
模型的功能,所以我相信,只要你没有删除与密码相关的字段, ResetPasswordView
将起作用。
另一种查看方式是通过身份验证视图。如果您的自定义 AbstractUser
模型可以默认获得 login/signup 授权视图(甚至通过管理仪表板进行更改),我看不出为什么您的模型不能接受 PasswordReserView
有任何问题。
我已经做过多次了。尽管我从未重置过我的用户密码,但我可以保证只要您不修改 username
、email
和 password
字段(您可以尝试,但这可能会毁了东西)
我打算构建一个自定义 Django 用户和一个自定义登录和注册视图,我想知道我是否也应该构建一个自定义密码重置视图。
If you’re entirely happy with Django’s User model, but you want to add some additional profile information, you could subclass
django.contrib.auth.models.AbstractUser
and add your custom profile fields
这意味着AbstractUser
将继承所有可以应用于User
模型的功能,所以我相信,只要你没有删除与密码相关的字段, ResetPasswordView
将起作用。
另一种查看方式是通过身份验证视图。如果您的自定义 AbstractUser
模型可以默认获得 login/signup 授权视图(甚至通过管理仪表板进行更改),我看不出为什么您的模型不能接受 PasswordReserView
有任何问题。
我已经做过多次了。尽管我从未重置过我的用户密码,但我可以保证只要您不修改 username
、email
和 password
字段(您可以尝试,但这可能会毁了东西)