From 4b65f2544d758f5cf0b68647313473a7e508c3b3 Mon Sep 17 00:00:00 2001
From: Bob The Burger <yofihzilif@sch.bme.hu>
Date: Thu, 2 Apr 2020 11:29:38 -0700
Subject: [PATCH] harmadik feladat

---
 DB/Database.py | 39 +++++++++++++++++++++++++++++++++++++++
 first_task     |  6 ------
 first_task.py  |  9 +++++----
 3 files changed, 44 insertions(+), 10 deletions(-)
 create mode 100644 DB/Database.py
 delete mode 100644 first_task

diff --git a/DB/Database.py b/DB/Database.py
new file mode 100644
index 0000000..72c2846
--- /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 fbe1ec1..0000000
--- 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 64a8dba..c62e441 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()
-- 
GitLab