1
0
Fork 0

search endpoint (user part)

This commit is contained in:
Mouse Reeve 2020-01-27 19:57:17 -08:00
parent d2d278b475
commit f7242452fa
6 changed files with 44 additions and 17 deletions

View file

@ -10,12 +10,6 @@ import re
class User(AbstractUser):
''' a user who wants to read books '''
full_username = models.CharField(
max_length=255,
blank=True,
null=True,
unique=True
)
private_key = models.TextField(blank=True, null=True)
public_key = models.TextField(blank=True, null=True)
api_key = models.CharField(max_length=255, blank=True, null=True)
@ -36,8 +30,8 @@ class User(AbstractUser):
if self.local and not self.actor:
self.actor = 'https://%s/api/u/%s' % (DOMAIN, self.username)
if self.local and not self.full_username:
self.full_username = '%s@%s' % (self.username, DOMAIN)
if self.local and not re.match(r'\w+@\w+.\w+', self.username):
self.username = '%s@%s' % (self.username, DOMAIN)
super().save(*args, **kwargs)