1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00
AdvLabDB/advlabdb/model_independent_funs.py
2023-11-01 21:49:10 +01:00

19 lines
465 B
Python

"""
Functions not dependent on advlabdb.models.
"""
import secrets
from string import ascii_letters, digits
from flask import current_app
PASSWORD_CHARS: str = ascii_letters + digits + "!%*+=?"
def randomPassword() -> str:
password_length = current_app.config["SECURITY_PASSWORD_LENGTH_MIN"]
return "".join(secrets.choice(PASSWORD_CHARS) for i in range(password_length))
def reportBadAttempt(message: str) -> None:
print("BAD ATTEMPT:", message)