login procedure in login.py. Proof of concept
This commit is contained in:
+3
-1
@@ -1,15 +1,17 @@
|
|||||||
import pymongo
|
import pymongo
|
||||||
import getpass
|
import getpass
|
||||||
|
import uuid
|
||||||
|
|
||||||
myclient = pymongo.MongoClient("mongodb://admin:pass@localhost:27017/")
|
myclient = pymongo.MongoClient("mongodb://admin:pass@localhost:27017/")
|
||||||
username = input("Username: ")
|
username = input("Username: ")
|
||||||
password = getpass.getpass("Password: ")
|
password = getpass.getpass("Password: ")
|
||||||
|
uuid = str(uuid.uuid4())
|
||||||
|
|
||||||
|
|
||||||
mydb = myclient["groclist_db"]
|
mydb = myclient["groclist_db"]
|
||||||
mycol = mydb["groclist_users"]
|
mycol = mydb["groclist_users"]
|
||||||
|
|
||||||
mydict = {"username": username, "password": password}
|
mydict = {"username": username, "password": password, "groclist_uuid": uuid}
|
||||||
if mycol.find_one({"username": username}):
|
if mycol.find_one({"username": username}):
|
||||||
print("Username already exists\n")
|
print("Username already exists\n")
|
||||||
exit()
|
exit()
|
||||||
|
|||||||
@@ -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")
|
||||||
|
|
||||||
Reference in New Issue
Block a user