Compare commits
4 Commits
desarrollo
...
88a7edba5c
| Author | SHA1 | Date | |
|---|---|---|---|
| 88a7edba5c | |||
| 5b98143117 | |||
| 3ed079542a | |||
| 2f6ad3b52c |
@@ -12,9 +12,6 @@ security = HTTPBasic(auto_error=False)
|
|||||||
BASIC_USER = os.getenv("BASIC_AUTH_USERNAME", "beyond")
|
BASIC_USER = os.getenv("BASIC_AUTH_USERNAME", "beyond")
|
||||||
BASIC_PASS = os.getenv("BASIC_AUTH_PASSWORD", "beyond2026")
|
BASIC_PASS = os.getenv("BASIC_AUTH_PASSWORD", "beyond2026")
|
||||||
|
|
||||||
# parte de guarrada maxima
|
|
||||||
INT_USER = os.getenv("INT_AUTH_USERNAME", "beyond")
|
|
||||||
INT_PASS = os.getenv("INT_AUTH_PASSWORD", "beyond2026")
|
|
||||||
|
|
||||||
def get_current_user(credentials: HTTPBasicCredentials | None = Depends(security)) -> str:
|
def get_current_user(credentials: HTTPBasicCredentials | None = Depends(security)) -> str:
|
||||||
"""
|
"""
|
||||||
@@ -32,13 +29,9 @@ def get_current_user(credentials: HTTPBasicCredentials | None = Depends(security
|
|||||||
correct_password = secrets.compare_digest(credentials.password, BASIC_PASS)
|
correct_password = secrets.compare_digest(credentials.password, BASIC_PASS)
|
||||||
|
|
||||||
if not (correct_username and correct_password):
|
if not (correct_username and correct_password):
|
||||||
# Guarrada maxima, yo no he sido
|
raise HTTPException(
|
||||||
correct_username = secrets.compare_digest(credentials.username, INT_USER)
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
correct_password = secrets.compare_digest(credentials.password, INT_PASS)
|
detail="Credenciales incorrectas",
|
||||||
if not (correct_username and correct_password):
|
)
|
||||||
raise HTTPException(
|
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
|
||||||
detail="Credenciales incorrectas",
|
|
||||||
)
|
|
||||||
|
|
||||||
return credentials.username
|
return credentials.username
|
||||||
|
|||||||
Reference in New Issue
Block a user