rukeshpaudel commited on
Commit
cda8418
·
1 Parent(s): dc72a59

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -0
app.py CHANGED
@@ -24,6 +24,15 @@ def check_credentials(email, password):
24
  new_email = {"email": email}
25
  user_collection.insert_one(new_email)
26
  print("New email created")
 
 
 
 
 
 
 
 
 
27
 
28
  if user is not None:
29
  with DatabaseIO(collection_name=os.environ['MONGO_COLLECTION_STUDIES']) as db_io_study:
 
24
  new_email = {"email": email}
25
  user_collection.insert_one(new_email)
26
  print("New email created")
27
+ with DatabaseIO(collection_name=os.environ['MONGO_COLLECTION_STUDIES']) as db_io_study:
28
+ study_collection = db_io_study.collection
29
+ study_id = ObjectId(password) # Convert the string to ObjectId
30
+ study = study_collection.find_one({"_id": study_id})
31
+
32
+ if study is not None:
33
+ return True
34
+ else:
35
+ return False
36
 
37
  if user is not None:
38
  with DatabaseIO(collection_name=os.environ['MONGO_COLLECTION_STUDIES']) as db_io_study: