修复登录bug

This commit is contained in:
cxykevin 2024-08-26 12:48:52 +08:00
parent c65f0bf66c
commit 7c24a7e965
1 changed files with 2 additions and 2 deletions

View File

@ -146,7 +146,7 @@ async def login_callback(response: Response, username: str = Form(), password: s
tkn = prep_uuid(uuid.uuid4().hex)
apikeys[tkn] = tokens[tokennow]
response.set_cookie("session", clean_uuid(tokennow))
return {"msg": "", "key": tkn}
return {"msg": "", "key": clean_uuid(tkn)}
else:
return {"msg": "用户名或密码错误", "key": ""}
@ -264,7 +264,7 @@ async def login(state: str = "", client_id: str = "", redirect_url: str = "/user
if (username != ""):
tkn = prep_uuid(uuid.uuid4().hex)
apikeys[tkn] = tokens[session]
return RedirectResponse(url=redirect_url+f"#access_token={tkn}&token_type=Bearer&state={state}")
return RedirectResponse(url=redirect_url+f"#access_token={clean_uuid(tkn)}&token_type=Bearer&state={state}")
return templates.TemplateResponse("login.html", {"request": {}, "redirect_url": redirect_url, "state": state})