Backend implementation for random passwords
This commit is contained in:
parent
c9e987a28f
commit
f64406c74b
1 changed files with 51 additions and 0 deletions
51
backend/src/password_util.py
Normal file
51
backend/src/password_util.py
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
from random import seed
|
||||||
|
from random import randint
|
||||||
|
import time
|
||||||
|
|
||||||
|
seed(int(time.time()))
|
||||||
|
|
||||||
|
|
||||||
|
def get_random_value(list_length):
|
||||||
|
random_select = randint(0, list_length)
|
||||||
|
return random_select
|
||||||
|
|
||||||
|
def get_password():
|
||||||
|
|
||||||
|
first_part = [
|
||||||
|
"Der Vogel",
|
||||||
|
"Die Ameise",
|
||||||
|
"Die Biene",
|
||||||
|
"Ein Mensch",
|
||||||
|
"Jemand",
|
||||||
|
]
|
||||||
|
|
||||||
|
second_part = [
|
||||||
|
"frisst",
|
||||||
|
"küsst",
|
||||||
|
"begrüsst",
|
||||||
|
]
|
||||||
|
|
||||||
|
third_part = [
|
||||||
|
"den Vogel",
|
||||||
|
"die Mücke",
|
||||||
|
"den Adler",
|
||||||
|
"den Apfel",
|
||||||
|
"die Birne",
|
||||||
|
"die Biene",
|
||||||
|
"eine Gurke",
|
||||||
|
]
|
||||||
|
|
||||||
|
forth_part = [
|
||||||
|
"auf der Terasse.",
|
||||||
|
"auf der Wiese.",
|
||||||
|
"im Garten.",
|
||||||
|
"in der Kühltruhe.",
|
||||||
|
]
|
||||||
|
|
||||||
|
password = ""
|
||||||
|
password += str(first_part[get_random_value(len(first_part)-1)])
|
||||||
|
password += " " + str(second_part[get_random_value(len(second_part)-1)])
|
||||||
|
password += " " + str(third_part[get_random_value(len(third_part)-1)])
|
||||||
|
password += " " + str(forth_part[get_random_value(len(forth_part)-1)])
|
||||||
|
|
||||||
|
return password
|
Loading…
Reference in a new issue