Skip to content

Commit

Permalink
Use standard secrets module for password generation
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Nov 7, 2023
1 parent 532235e commit 91240b3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/mailadm/util.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import base64
import random
import secrets
import sys


def gen_password():
with open("/dev/urandom", "rb") as f:
s = f.read(21)
return base64.b64encode(s).decode("ascii")[:12]
return secrets.token_urlsafe(20)


def get_human_readable_id(len=5, chars="2345789acdefghjkmnpqrstuvwxyz"):
Expand Down

0 comments on commit 91240b3

Please sign in to comment.