XThomasBU commited on
Commit
554801e
·
verified ·
1 Parent(s): ffebadf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -35,6 +35,18 @@ from typing import Dict, Optional
35
  import chainlit as cl
36
 
37
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  print(os.getenv("OPENID_PROVIDER_URL"))
39
  print(os.getenv("OAUTH_CLIENT_ID"))
40
 
 
35
  import chainlit as cl
36
 
37
 
38
+ @cl.password_auth_callback
39
+ def auth_callback(username: str, password: str):
40
+ # Fetch the user matching username from your database
41
+ # and compare the hashed password with the value stored in the database
42
+ if (username, password) == ("admin", "admin"):
43
+ return cl.User(
44
+ identifier="admin", metadata={"role": "admin", "provider": "credentials"}
45
+ )
46
+ else:
47
+ return None
48
+
49
+
50
  print(os.getenv("OPENID_PROVIDER_URL"))
51
  print(os.getenv("OAUTH_CLIENT_ID"))
52