pyfedi/app/auth/util.py

13 lines
334 B
Python
Raw Normal View History

import random
2024-01-15 17:26:57 +13:00
from unicodedata import normalize
# Return a random string of 6 letter/digits.
def random_token(length=6) -> str:
return "".join(
[random.choice('0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ') for x in range(length)])
2024-01-15 17:26:57 +13:00
def normalize_utf(username):
return normalize('NFKC', username)