Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -32,8 +32,10 @@ import bcrypt
|
|
| 32 |
def auth_callback(username: str, password: str):
|
| 33 |
#resultLogAdmin = bcrypt.checkpw(username.encode('utf-8'), bcrypt.hashpw(os.environ['CHAINLIT_AUTH_LOGIN'].encode('utf-8'), bcrypt.gensalt()))
|
| 34 |
#resultPwdAdmin = bcrypt.checkpw(password.encode('utf-8'), bcrypt.hashpw(os.environ['CHAINLIT_AUTH_PASSWD'].encode('utf-8'), bcrypt.gensalt()))
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
| 37 |
resultRole = next(d['role'] for d in os.environ['CHAINLIT_AUTH_LOGIN'] if d['ident'] == username)
|
| 38 |
if resultLogAdmin and resultPwdAdmin and resultRole == "admindatapcc":
|
| 39 |
return cl.User(
|
|
|
|
| 32 |
def auth_callback(username: str, password: str):
|
| 33 |
#resultLogAdmin = bcrypt.checkpw(username.encode('utf-8'), bcrypt.hashpw(os.environ['CHAINLIT_AUTH_LOGIN'].encode('utf-8'), bcrypt.gensalt()))
|
| 34 |
#resultPwdAdmin = bcrypt.checkpw(password.encode('utf-8'), bcrypt.hashpw(os.environ['CHAINLIT_AUTH_PASSWD'].encode('utf-8'), bcrypt.gensalt()))
|
| 35 |
+
ident = next(d['ident'] for d in os.environ['CHAINLIT_AUTH_LOGIN'] if d['ident'] == username)
|
| 36 |
+
pwd = next(d['pwd'] for d in os.environ['CHAINLIT_AUTH_LOGIN'] if d['ident'] == username)
|
| 37 |
+
resultLogAdmin = bcrypt.checkpw(username.encode('utf-8'), bcrypt.hashpw(ident.encode('utf-8'), bcrypt.gensalt()))
|
| 38 |
+
resultPwdAdmin = bcrypt.checkpw(password.encode('utf-8'), bcrypt.hashpw(pwd.encode('utf-8'), bcrypt.gensalt()))
|
| 39 |
resultRole = next(d['role'] for d in os.environ['CHAINLIT_AUTH_LOGIN'] if d['ident'] == username)
|
| 40 |
if resultLogAdmin and resultPwdAdmin and resultRole == "admindatapcc":
|
| 41 |
return cl.User(
|