Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
pcartas committed Sep 25, 2024
1 parent 1bce378 commit f532d44
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tljh/normalize.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import hashlib
from tljh.config import HASH_USERNAME
import os


def generate_system_username(username):
Expand All @@ -25,7 +26,7 @@ def generate_system_username(username):
str: The generated POSIX-compliant username.
"""

if HASH_USERNAME:
if os.getenv("TLJH_HASH_USERNAME", HASH_USERNAME):
if len(username) < 26:
return username

Expand Down
3 changes: 2 additions & 1 deletion tljh/user_creating_spawner.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from systemdspawner import SystemdSpawner
from traitlets import Dict, List, Unicode
import os

from tljh import user
from tljh.normalize import generate_system_username
Expand All @@ -19,7 +20,7 @@ def start(self):
Perform system user activities before starting server
"""
# FIXME: Move this elsewhere? Into the Authenticator?
system_username = generate_system_username(USERNAME_PREFIX + self.user.name)
system_username = generate_system_username(os.getenv("TLJH_USERNAME_PREFIX", USERNAME_PREFIX) + self.user.name)

# FIXME: This is a hack. Allow setting username directly instead
self.username_template = system_username
Expand Down

0 comments on commit f532d44

Please sign in to comment.