Changes between Version 1 and Version 2 of ContribEmailAuth
- Timestamp:
- Sep 18, 2013, 8:13:34 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ContribEmailAuth
v1 v2 11 11 A number of solutions have been proposed. Here is a summary of the most viable candidates: 12 12 13 == Option 1: S omething ==13 == Option 1: Simple auth.User analog == 14 14 15 Build a thing. 15 Feature branch: https://github.com/tanderegg/django/tree/ticket_20824_master 16 17 This option is a simple analog to the auth.User model. In auth_email.models, there is an AbstractUser class that inherits from AbstractBaseUser and PermissionsMixin, and contains the fields email, first_name, last_name, is_active, and is_staff, basically identical to auth.User with the exception of having no username. the auth_email.models.User class then extends the AbstractUser class to make it instantiable and swappable. A custom UserManager class adds in methods for creating users and superusers. 18 19 The auth_email.admin.UserAdmin class inherits from auth.admin.UserAdmin and overides the appropriate members and methods, including pointing the class to the custom UserCreationForm and UserChangeForm in auth_email.forms. These forms are again nearly identical to the ones in auth.forms. 20 21 The approach I took is very similar to the one used in https://github.com/Liberationtech/django-libtech-emailuser. The primary difference is that django-libtech-emailuser does not contain a new abstract class, and instead contains a single concrete class EmailUser. 16 22 17 23 === Advantages === 18 24 19 * Something 25 * Simple implementation, a developer must only include auth_email in INSTALLED_APPS and set AUTH_USER_MODEL = 'auth_email.User'. 26 * Principle of least surprise: auth_email.User should behave exactly as auth.User would, with the exception of no username. 27 * A small amount of new code means fewer opportunities to introduce new bugs. 28 * Makes few assumptions about how an email user should behave, which leaves further implementation up to each use case 20 29 21 30 === Problems === 22 31 23 * Something32 * django.contrib.auth could potentially be modified a bit to reduce code duplication, specifically with regards to admin.UserAdmin. If there is interest in this I will modify my branch. 24 33 25 34 == Final decision ==