Set username for non-superusers only
This commit is contained in:
parent
79458d54cb
commit
3f37fe4826
1 changed files with 5 additions and 1 deletions
|
@ -21,7 +21,11 @@ class OTPSeed(AbstractUser):
|
|||
"""
|
||||
inject username to ensure it stays unique / is setup at all
|
||||
"""
|
||||
if not self.is_superuser:
|
||||
self.username = "{}@{}".format(self.name, self.realm)
|
||||
else:
|
||||
self.name = self.username
|
||||
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
|
|
Loading…
Reference in a new issue