mirror of
https://github.com/bugsink/bugsink.git
synced 2026-01-06 05:10:15 -06:00
createsuperuser and how it relates to email-based addresses: document
chaning actual createsuperuser behavior is usually done using the USERNAME_FIELD but that field has other repurcussions (that we don't want) too
This commit is contained in:
@@ -146,7 +146,8 @@ ls *.sqlite3
|
||||
|
||||
You can create a superuser account to access the Bugsink admin interface.
|
||||
|
||||
Run the following command and follow the prompts:
|
||||
Run the following command and follow the prompts (to stay consistent with usernames in the rest of the system, you may
|
||||
want to use your email-address as a username):
|
||||
|
||||
```bash
|
||||
bugsink-manage createsuperuser
|
||||
|
||||
@@ -21,6 +21,11 @@ UserModel = get_user_model()
|
||||
|
||||
class UserCreationForm(BaseUserCreationForm):
|
||||
|
||||
# Our UserCreationForm is the place where the "use email for usernames" logic is implemented.
|
||||
# We could instead push such logic in the model, and do it more thoroughly (i.e. remove either field, and point the
|
||||
# USERNAME_FIELD to the other). But I'm not sure that this is the most future-proof way forward. In particular,
|
||||
# external systems (AD, OAuth, etc.) may have 2 fields rather than 1.
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields['username'].validators = [EmailValidator()]
|
||||
|
||||
Reference in New Issue
Block a user