mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
19 lines
478 B
Python
19 lines
478 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) # TODO: Log
|