Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Commit

Permalink
fix: microverse cookies
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbricman committed Feb 28, 2022
1 parent ac4db59 commit de4f358
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,4 @@ async def microverse_list_handler(request: Request, authorization: HTTPBasicCred

@app.get('/custodian/check')
async def check_custodian(request: Request, authorization: HTTPBasicCredentials = Depends(security)):
return auth(authorization.credentials)
return auth(authorization.credentials, True)
6 changes: 5 additions & 1 deletion backend/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json


def auth(token):
def auth(token, compact=False):
if not token:
return {
'custodian': False
Expand Down Expand Up @@ -35,6 +35,10 @@ def auth(token):
authorized_microverse = [
e for e in microverses if e['token'] == token]

if compact:
if len(authorized_microverse) > 0:
authorized_microverse[0].pop('embeddings')

return {
'custodian': False,
'authorized_microverse': authorized_microverse
Expand Down
Binary file modified frontend/components/__pycache__/microverses.cpython-38.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion frontend/components/microverses.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def paint():
cookie_manager.set(
'microverses', microverses, expires_at=datetime.datetime.now() + datetime.timedelta(days=30))
st.session_state['microverses'] = microverses
sleep(0.4)
sleep(0.5)

st.experimental_rerun()

Expand Down

0 comments on commit de4f358

Please sign in to comment.