Generate a random username right away if no preferred username has been given

This commit is contained in:
kolaente 2020-11-19 20:22:53 +01:00
parent da6a80d4a9
commit 544ddc757e
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 4 additions and 1 deletions

View File

@ -228,7 +228,10 @@ func getOrCreateUser(cl *claims, issuer, subject string) (u *user.User, err erro
Subject: subject,
}
// TODO: Check if we actually have a preferred username and generate a random one right away if we don't
// Check if we actually have a preferred username and generate a random one right away if we don't
if uu.Username == "" {
uu.Username = petname.Generate(3, "-")
}
u, err = user.CreateUser(uu)
if err != nil && !user.IsErrUsernameExists(err) {