Update app.py
Browse files
app.py
CHANGED
@@ -6,12 +6,6 @@ access_token = os.environ.get('HF_TOKEN')
|
|
6 |
|
7 |
ui = gr.load("sun000090/gradio_space", hf_token=access_token, src="spaces")
|
8 |
|
9 |
-
# def environ_auth(username, password):
|
10 |
-
# if username == os.environ["username"] and password == os.environ["password"]:
|
11 |
-
# return True
|
12 |
-
# else:
|
13 |
-
# return False
|
14 |
-
|
15 |
### Fetch MongoDB Authentication
|
16 |
uri = os.environ.get('MONGODB_URI')
|
17 |
client = MongoClient(uri, connect=True)
|
@@ -20,14 +14,13 @@ userLogin = db['LoginDetails']
|
|
20 |
def check_credentials(email, password):
|
21 |
user = userLogin.find_one({'email': email})
|
22 |
if not user or user['password'] != password:
|
23 |
-
return
|
24 |
-
return
|
25 |
|
26 |
-
|
27 |
### Authenticate through space
|
28 |
def environ_auth(username, password):
|
29 |
auth_ = check_credentials(username, password)
|
30 |
-
if
|
31 |
return True
|
32 |
else:
|
33 |
return False
|
|
|
6 |
|
7 |
ui = gr.load("sun000090/gradio_space", hf_token=access_token, src="spaces")
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
### Fetch MongoDB Authentication
|
10 |
uri = os.environ.get('MONGODB_URI')
|
11 |
client = MongoClient(uri, connect=True)
|
|
|
14 |
def check_credentials(email, password):
|
15 |
user = userLogin.find_one({'email': email})
|
16 |
if not user or user['password'] != password:
|
17 |
+
return 'Incorrect'
|
18 |
+
return 'Correct'
|
19 |
|
|
|
20 |
### Authenticate through space
|
21 |
def environ_auth(username, password):
|
22 |
auth_ = check_credentials(username, password)
|
23 |
+
if auth_=='Correct':
|
24 |
return True
|
25 |
else:
|
26 |
return False
|