-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.py
63 lines (50 loc) · 1.2 KB
/
signup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 7 15:00:33 2019
@author: ayaz
"""
import getpass
from pymongo import MongoClient
myclient = MongoClient()
mydb = myclient["project"]
mycol = mydb["accounts"]
print("Username: ")
username = input()
for i in mycol.find({},{ "_id":0, "username": 1 }):
string = str(i)
string = string[14:21]
if(username == string):
print("The username already exits please choose another one!")
print("Username: ")
username = input()
print("Name: ")
name = input()
print("email: ")
email = input()
password = getpass.getpass('Enter your Password: ')
print("address: ")
address = input()
print("""
Enter your allergy type:
1. GLUTEN
2. SOY
3. MILK/LACTOSE
4. EGG
5. NUTS
""")
allergytype = input()
if(allergytype == 1):
allergy = "gluten"
elif(allergytype == 2):
allergy = "soy"
elif(allergytype == 3):
allergy = "milk/lactose"
elif(allergytype == 4):
allergy = "egg"
else:
allergy = "nut"
mydict = { "username": username,"name": name, "email": email, "address": address, "allergytype": allergytype, "password": password}
x = mycol.insert_one(mydict)
print("Account Created!")
import main