|
@@ -125,27 +125,65 @@ async def home(request: Request):
|
|
|
return templates.TemplateResponse(name='home.html', context={'request': request})
|
|
|
|
|
|
@app.get('/tower', response_class=HTMLResponse)
|
|
|
-async def tower(request: Request):
|
|
|
+async def tower(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
+ try:
|
|
|
+ Authorize.jwt_required()
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return RedirectResponse('/login')
|
|
|
+ # current_user = Authorize.get_jwt_subject()
|
|
|
return templates.TemplateResponse(name='tower.html', context={'request': request})
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@app.get('/optim', response_class=HTMLResponse)
|
|
|
-async def optim(request: Request):
|
|
|
+async def optim(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
+ try:
|
|
|
+ Authorize.jwt_required()
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return RedirectResponse('/login')
|
|
|
+ # current_user = Authorize.get_jwt_subject()
|
|
|
return templates.TemplateResponse(name='optim.html', context={'request': request})
|
|
|
|
|
|
@app.get('/vibration', response_class=HTMLResponse)
|
|
|
-async def vibration(request: Request):
|
|
|
+async def vibration(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
+ try:
|
|
|
+ Authorize.jwt_required()
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return RedirectResponse('/login')
|
|
|
+ # current_user = Authorize.get_jwt_subject()
|
|
|
return templates.TemplateResponse(name='vibration.html', context={'request': request})
|
|
|
|
|
|
@app.get('/history', response_class=HTMLResponse)
|
|
|
-async def history(request: Request):
|
|
|
+async def history(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
+ try:
|
|
|
+ Authorize.jwt_required()
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return RedirectResponse('/login')
|
|
|
+ # current_user = Authorize.get_jwt_subject()
|
|
|
return templates.TemplateResponse(name='history.html', context={'request': request})
|
|
|
|
|
|
@app.get('/device', response_class=HTMLResponse)
|
|
|
-async def device(request: Request):
|
|
|
+async def device(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
+ try:
|
|
|
+ Authorize.jwt_required()
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return RedirectResponse('/login')
|
|
|
+ # current_user = Authorize.get_jwt_subject()
|
|
|
return templates.TemplateResponse(name='device.html', context={'request': request})
|
|
|
|
|
|
@app.get('/system', response_class=HTMLResponse)
|
|
|
-async def system(request: Request):
|
|
|
+async def system(request: Request, Authorize: AuthJWT = Depends()):
|
|
|
+ try:
|
|
|
+ Authorize.jwt_required()
|
|
|
+ except Exception as e:
|
|
|
+ print(e)
|
|
|
+ return RedirectResponse('/login')
|
|
|
+ # current_user = Authorize.get_jwt_subject()
|
|
|
return templates.TemplateResponse(name='system.html', context={'request': request})
|
|
|
|
|
|
|