Skip to content

Commit

Permalink
Ignore boring Planka "usernames"
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc-Andrieu committed Jan 14, 2025
1 parent f650310 commit 38fd7a3
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions app/utils/auth/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,20 +418,13 @@ class PlankaAuthClient(BaseAuthClient):

@classmethod
def get_userinfo(cls, user: models_core.CoreUser):
# Must match ^[a-zA-Z0-9]+((_|\.)?[a-zA-Z0-9])*$
username = unidecode.unidecode(
f"{user.firstname.strip()}.{user.name.strip()}",
).replace(" ", "_")
username = re.sub(r"[^a-zA-Z0-9._]", "", username)

return {
"sub": user.id,
"name": get_display_name(
firstname=user.firstname,
name=user.name,
nickname=user.nickname,
),
"preferred_username": username,
"groups": [group.name for group in user.groups] + [user.account_type.value],
"email": user.email,
}

0 comments on commit 38fd7a3

Please sign in to comment.