Fix auth handling on user update

This commit is contained in:
Georges-Antoine Assi
2024-03-06 09:53:29 -05:00
parent f15d7c666a
commit 07cc82b627
4 changed files with 5 additions and 6 deletions

View File

@@ -42,8 +42,7 @@ pipx install --suffix _npm git+https://github.com/radoering/poetry.git@non-packa
More info: https://github.com/python-poetry/poetry/pull/8650
Then creat the virtual environment
Then create the virtual environment
```sh
# Fix disable parallel installation stuck: $> poetry_npm config experimental.new-installer false

View File

@@ -26,7 +26,7 @@ DB_PASSWD: Final = os.environ.get("DB_PASSWD")
DB_NAME: Final = os.environ.get("DB_NAME", "romm")
# REDIS
REDIS_HOST: Final = "localhost"
REDIS_HOST: Final = "127.0.0.1"
REDIS_PORT: Final = 6379
# IGDB

View File

@@ -149,7 +149,7 @@ def update_user(
"hashed_password"
)
if request.user.id == id and creds_updated:
auth_handler.clear_session(request)
request.session.clear()
return db_user_handler.get_user(id)

View File

@@ -77,7 +77,7 @@ class AuthHandler:
# Key exists therefore user is probably authenticated
user = db_user_handler.get_user_by_username(username)
if user is None:
conn.session.clear()
conn.session = {}
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN,
@@ -85,7 +85,7 @@ class AuthHandler:
)
if not user.enabled:
conn.session.clear()
conn.session = {}
raise HTTPException(
status_code=status.HTTP_403_FORBIDDEN, detail="Inactive user"