bughunting for /login
This commit is contained in:
+14
-6
@@ -2,21 +2,29 @@ import pymongo
|
||||
import getpass
|
||||
import uuid
|
||||
|
||||
myclient = pymongo.MongoClient("mongodb://admin:pass@localhost:27017/")
|
||||
# initialize connection to database
|
||||
config = {
|
||||
"username": "admin",
|
||||
"password": "pass",
|
||||
"server": "localhost:27017",
|
||||
}
|
||||
connector = "mongodb://{}:{}@{}".format(config["username"],config["password"], config["server"])
|
||||
client = pymongo.MongoClient(connector)
|
||||
db = client["groclist"]
|
||||
|
||||
username = input("Username: ")
|
||||
password = getpass.getpass("Password: ")
|
||||
uuid = str(uuid.uuid4())
|
||||
email = input("Email-adres: ")
|
||||
full_name = input("Volledige naam: ")
|
||||
|
||||
mydb = myclient["groclist_db"]
|
||||
mycol = mydb["groclist_users"]
|
||||
col = db["cred"]
|
||||
|
||||
mydict = {"username": username, "password": password, "groclist_uuid": uuid, "email": email, "name": full_name}
|
||||
if mycol.find_one({"username": username}):
|
||||
mydict = {"username": username, "password": password, "uuid": uuid, "email": email, "name": full_name}
|
||||
if col.find_one({"username": username}):
|
||||
print("Username already exists\n")
|
||||
exit()
|
||||
else:
|
||||
x = mycol.insert_one(mydict)
|
||||
x = col.insert_one(mydict)
|
||||
print("User created")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user