Spaces:
Paused
Paused
add salt hash
Browse files- app.py +4 -1
- passwords.txt +2 -2
app.py
CHANGED
|
@@ -283,11 +283,14 @@ with gr.Blocks() as demo:
|
|
| 283 |
# advanced.click(show_advanced, inputs=[], outputs=[model, temperature])
|
| 284 |
|
| 285 |
|
|
|
|
| 286 |
def authf(username, password):
|
| 287 |
try:
|
| 288 |
with open("passwords.txt", "r") as f:
|
| 289 |
for line in f.readlines():
|
| 290 |
-
|
|
|
|
|
|
|
| 291 |
return True
|
| 292 |
except Exception as e:
|
| 293 |
print("Error reading password", e)
|
|
|
|
| 283 |
# advanced.click(show_advanced, inputs=[], outputs=[model, temperature])
|
| 284 |
|
| 285 |
|
| 286 |
+
import bcrypt
|
| 287 |
def authf(username, password):
|
| 288 |
try:
|
| 289 |
with open("passwords.txt", "r") as f:
|
| 290 |
for line in f.readlines():
|
| 291 |
+
u, p = line.strip().split()
|
| 292 |
+
# print(u, p, password)
|
| 293 |
+
if u == username and bcrypt.checkpw(password.encode('utf-8'), p.encode('utf-8')):
|
| 294 |
return True
|
| 295 |
except Exception as e:
|
| 296 |
print("Error reading password", e)
|
passwords.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
| 1 |
-
admin
|
| 2 |
-
user1@dreem.ai
|
|
|
|
| 1 |
+
admin $2b$12$MVN9ESLVpa5U2fWXUA6VneR23haEZf629xWu384EGcJ7baO.pW8ge
|
| 2 |
+
user1@dreem.ai $2b$12$Ea1Gzf9psuUN/Urqc1bRJuFKool9Duy1rHpTfayfXdbWKxO67W0qe
|