From b2078ad340f45c8343e25add164ee7616dd85553 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E5=B0=8F=E4=B8=98?= Date: Thu, 6 Mar 2025 09:21:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=AE=98=E6=96=B9=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E7=9A=84=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- login.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/login.py b/login.py index eac93ef..3b5beb6 100644 --- a/login.py +++ b/login.py @@ -19,16 +19,16 @@ from fastapi.responses import RedirectResponse def create() -> Optional[RedirectResponse]: @ui.page('/login') - async def session(): + async def session(redirect_to: str = '/'): # 检测是否已登录 if app.storage.user.get('authenticated', False): - return ui.navigate.to('/admin') + ui.navigate.to(redirect_to) ui.page_title('登录 Findreve') async def try_login() -> None: app.storage.user.update({'authenticated': True}) # 跳转到用户上一页 - ui.navigate.to(app.storage.user.get('referrer_path', '/')) + ui.navigate.to(redirect_to) async def login(): if username.value == "" or password.value == "": @@ -46,7 +46,7 @@ def create() -> Optional[RedirectResponse]: # 存储用户信息 app.storage.user.update({'authenticated': True}) # 跳转到用户上一页 - ui.navigate.to(app.storage.user.get('referrer_path', '/')) + ui.navigate.to(redirect_to) with ui.header() \