login procedure in login.py. Proof of concept

This commit is contained in:
2022-03-12 16:27:54 +01:00
parent ab379673b2
commit da86395744
2 changed files with 20 additions and 1 deletions
+3 -1
View File
@@ -1,15 +1,17 @@
import pymongo
import getpass
import uuid
myclient = pymongo.MongoClient("mongodb://admin:pass@localhost:27017/")
username = input("Username: ")
password = getpass.getpass("Password: ")
uuid = str(uuid.uuid4())
mydb = myclient["groclist_db"]
mycol = mydb["groclist_users"]
mydict = {"username": username, "password": password}
mydict = {"username": username, "password": password, "groclist_uuid": uuid}
if mycol.find_one({"username": username}):
print("Username already exists\n")
exit()
+17
View File
@@ -0,0 +1,17 @@
import pymongo
import getpass
myclient = pymongo.MongoClient("mongodb://admin:pass@localhost:27017/")
username = input("Username: ")
password = getpass.getpass("Password: ")
mydb = myclient["groclist_db"]
mycol = mydb["groclist_users"]
#mydict = {"username": username, "password": enc_password}
if mycol.find_one({"username": username, "password": password}):
print("login success\n")
exit()
else:
print("Login Failed")