From c5bb590b2de48f04ff9532cd240c790f8297c284 Mon Sep 17 00:00:00 2001 From: swve Date: Sat, 24 Sep 2022 14:35:26 +0200 Subject: [PATCH] fix: add debug labels --- front/components/auth/HeaderProfileBox.tsx | 7 +++++-- front/components/ui/header.tsx | 14 ++++++++++++++ src/routers/users.py | 4 ++-- src/services/auth.py | 4 ++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/front/components/auth/HeaderProfileBox.tsx b/front/components/auth/HeaderProfileBox.tsx index 5e3e596a..d92586fc 100644 --- a/front/components/auth/HeaderProfileBox.tsx +++ b/front/components/auth/HeaderProfileBox.tsx @@ -9,7 +9,9 @@ export const HeaderProfileBox = () => { return ( {" "} - HeaderProfileBox {String(auth.isAuthenticated)}{" "} + + HeaderProfileBox
isLogged : {String(auth.isAuthenticated)}
user : {String(auth.userInfo.username)} +
{" "}
  • @@ -41,7 +43,8 @@ const ProfileArea = styled.div` padding: 6px; font-size: 12px; margin: 3px; - background-color: #19191939; + // blur + background-color: #19191960; border-radius: 5px; color: white; width: auto; diff --git a/front/components/ui/header.tsx b/front/components/ui/header.tsx index 6e58826f..a6010743 100644 --- a/front/components/ui/header.tsx +++ b/front/components/ui/header.tsx @@ -1,12 +1,26 @@ import React from "react"; import { Menu } from "./elements/menu"; import Link from 'next/link' +import styled from "styled-components"; export const Header = () => { return (
    + 🚧 Pre-Alpha
    ); }; + +const PreAlphaLabel = styled.div` + position: fixed; + bottom: 0; + right: 0; + padding: 9px; + background-color: #080501; + color: white; + font-size: 19px; + font-weight: bold; + border-radius: 5px 0 0 0px; + `; diff --git a/src/routers/users.py b/src/routers/users.py index b95c72f7..b2ed16da 100644 --- a/src/routers/users.py +++ b/src/routers/users.py @@ -4,7 +4,7 @@ from pydantic import BaseModel from src.services.auth import * from src.services.users import * -oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/api/auth/token") + router = APIRouter() @@ -18,7 +18,7 @@ async def api_get_current_user(current_user: User = Depends(get_current_user)): return current_user.dict() @router.get("/profile") -async def api_get_current_user(current_user: User = Depends(get_current_user_jwt)): +async def api_get_current_user(current_user: User = Depends(get_current_user)): """ Get current user """ diff --git a/src/services/auth.py b/src/services/auth.py index e1345cef..ee528464 100644 --- a/src/services/auth.py +++ b/src/services/auth.py @@ -62,7 +62,7 @@ def create_access_token(data: dict, expires_delta: timedelta | None = None): return encoded_jwt # DEPRECATED -async def get_current_user(token: str = Depends(oauth2_scheme)): +async def get_current_user_old(token: str = Depends(oauth2_scheme)): credentials_exception = HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Could not validate credentials", @@ -82,7 +82,7 @@ async def get_current_user(token: str = Depends(oauth2_scheme)): return PublicUser(**user.dict()) -async def get_current_user_jwt(Authorize: AuthJWT = Depends()): +async def get_current_user(Authorize: AuthJWT = Depends()): credentials_exception = HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail="Could not validate credentials",