username should not be unique, requires migration
This commit is contained in:
parent
4b1a347200
commit
069833a838
2 changed files with 8 additions and 1 deletions
|
@ -91,7 +91,7 @@ class OAuth2Backend(ModelBackend):
|
|||
|
||||
# when username is provided, assume that token is newly obtained and valid
|
||||
try:
|
||||
user = UserModel._default_manager.get_by_natural_key(user_data['username'])
|
||||
user = UserModel._default_manager.filter(username=username, mastodon_site=site)
|
||||
except UserModel.DoesNotExist:
|
||||
return None
|
||||
else:
|
||||
|
|
|
@ -14,6 +14,13 @@ def report_image_path(instance, filename):
|
|||
|
||||
|
||||
class User(AbstractUser):
|
||||
if settings.MASTODON_ALLOW_ANY_SITE:
|
||||
username = models.CharField(
|
||||
_('username'),
|
||||
max_length=150,
|
||||
unique=False,
|
||||
help_text=_('Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.'),
|
||||
)
|
||||
mastodon_id = models.CharField(max_length=100, blank=False)
|
||||
# mastodon domain name, eg donotban.com
|
||||
mastodon_site = models.CharField(max_length=100, blank=False)
|
||||
|
|
Loading…
Add table
Reference in a new issue