Remove disabled login check from login endpoint

This commit is contained in:
Georges-Antoine Assi
2025-03-21 14:58:47 -04:00
parent 03c91affcd
commit db26248f04
2 changed files with 1 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
from datetime import datetime, timedelta, timezone
from typing import Annotated, Final
from config import DISABLE_USERPASS_LOGIN, OIDC_ENABLED, OIDC_REDIRECT_URI
from config import OIDC_ENABLED, OIDC_REDIRECT_URI
from decorators.auth import oauth
from endpoints.forms.identity import OAuth2RequestForm
from endpoints.responses import MessageResponse
@@ -11,7 +11,6 @@ from exceptions.auth_exceptions import (
OIDCDisabledException,
OIDCNotConfiguredException,
UserDisabledException,
UserPassDisabledException,
)
from fastapi import Depends, HTTPException, Request, status
from fastapi.responses import RedirectResponse
@@ -48,9 +47,6 @@ def login(
MessageResponse: Standard message response
"""
if DISABLE_USERPASS_LOGIN:
raise UserPassDisabledException
user = auth_handler.authenticate_user(credentials.username, credentials.password)
if not user:
raise AuthCredentialsException

View File

@@ -1,10 +1,5 @@
from fastapi import HTTPException, status
UserPassDisabledException = HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail="Username/password authentication disabled",
)
AuthCredentialsException = HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Incorrect username or password",