diff --git a/DB/Database.py b/DB/Database.py new file mode 100644 index 0000000000000000000000000000000000000000..72c2846c74469603f4967e6ea1cd4e18befffd55 --- /dev/null +++ b/DB/Database.py @@ -0,0 +1,39 @@ +""" +ez file lenne ami ossyekoti a db-t a programunkal. hogy egyszerubb legyen +az eletunk, ezert most csak egyszeru dictekbe, meg setekbe tarolunk mindent +""" + +fake_db = {} + + +def check_user_name(username=None): + if not username: + return 'No name given' + if username in fake_db['u_names']: # legyen u_names a usernevek setje + return 'Username taken' + else: + return '' + + +def hasNumbers(inputString): + return any(char.isdigit() for char in inputString) + + +def validate_password(password=None): + if isinstance(password, str) is False: + return 'Bad password' + elif len(password) < 8 or 'dick' in password: + return 'Password is too short' + elif hasNumbers(password) is False: + return 'must contain number' + else: + return '' + + +def create_user(username, password): + try: + fake_db['u_names'].add(username) + fake_db['users'].append({'Username': username, 'Password': password}) + except Exception as e: + return 'oopsie', e + return True diff --git a/first_task b/first_task deleted file mode 100644 index fbe1ec125727571c014b9be7d0b70c3748d351cb..0000000000000000000000000000000000000000 --- a/first_task +++ /dev/null @@ -1,6 +0,0 @@ ->>> def Kiiro(): -... print("gimme your name") -... txt = input() -... print(txt) -... ->>> Kiiro() diff --git a/first_task.py b/first_task.py index 64a8dbadc0fbd99d880638776fbcbb7067d2ff64..c62e441cf8f1f07f42c02eb799bd85ebd9c634a1 100644 --- a/first_task.py +++ b/first_task.py @@ -1,7 +1,8 @@ def Kiiro(): - print("gimme your name") - txt = input() - print(txt) + print("gimme your name") + txt = input() + print(txt) + if __name__ == "__main__": - Kiiro() + Kiiro()