Compare commits
No commits in common. "fd002e3718a1b18ccab9a48600150a758803c606" and "d5f3708c506c0f219f484df69fff38e72781ded2" have entirely different histories.
fd002e3718
...
d5f3708c50
@ -16,8 +16,7 @@ RUN apt update && apt full-upgrade -y
|
|||||||
|
|
||||||
# Install pip requirements
|
# Install pip requirements
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install -U pip setuptools wheel
|
RUN python -m pip install -r requirements.txt
|
||||||
RUN pip install -r requirements.txt
|
|
||||||
|
|
||||||
COPY . /app
|
COPY . /app
|
||||||
|
|
||||||
|
@ -109,23 +109,17 @@ def check_account(name: str, login: str, passwd: str) -> bool:
|
|||||||
return check_account_name(name) and check_login(login) and check_passwd(passwd)
|
return check_account_name(name) and check_login(login) and check_passwd(passwd)
|
||||||
|
|
||||||
|
|
||||||
def _check_gened_password(passwd: str, /) -> bool:
|
|
||||||
"""Retuns true if generated password is valid,
|
|
||||||
false otherwise.
|
|
||||||
Password is valid if there is at least one lowercase character,
|
|
||||||
uppercase character and one punctuation character"""
|
|
||||||
return (
|
|
||||||
any(c.islower() for c in passwd)
|
|
||||||
and any(c.isupper() for c in passwd)
|
|
||||||
and any(c.isdigit() for c in passwd)
|
|
||||||
and any(c in PUNCTUATION for c in passwd)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def gen_passwd() -> str:
|
def gen_passwd() -> str:
|
||||||
"""Generates password of length 32"""
|
"""Generates password of length 32"""
|
||||||
choices = SystemRandom().choices
|
choices = SystemRandom().choices
|
||||||
while True:
|
while True:
|
||||||
passwd = "".join(choices(PASSWORD_CHARS, k=32))
|
passwd = "".join(choices(PASSWORD_CHARS, k=32))
|
||||||
if _check_gened_password(passwd):
|
# If there is at least one lowercase character, uppercase character
|
||||||
|
# and one punctuation character
|
||||||
|
if (
|
||||||
|
any(c.islower() for c in passwd)
|
||||||
|
and any(c.isupper() for c in passwd)
|
||||||
|
and any(c.isdigit() for c in passwd)
|
||||||
|
and any(c in PUNCTUATION for c in passwd)
|
||||||
|
):
|
||||||
return passwd
|
return passwd
|
||||||
|
Reference in New Issue
Block a user