简体   繁体   中英

Will the django built in password reset views work with a custom user that inherits from AbstractBaseUser?

I an going to build a custom django user and a custom log in and sign up views and I want to know if the I should build a custom password reset view as well.

From the documentation :

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

What this means is that an AbstractUser will inherit all functions that can be applied to the User model, so I believe that, as long as you didn't remove password-related fields, the ResetPasswordView will work.

Another way to look at this is through authentication views. If your custom AbstractUser model can get by the default login/signup auth views (even changes through the admin dashboard), I don't see any problem why your model can't take PasswordReserView .

I've done this multiple times. Although I've never reset my user's password, I can guarantee the default views will work as long as you don't modify your username , email , and password fields (you can try, but that may ruin things)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM