Skip to content

Commit

Permalink
Fixed user able to login with wrong password
Browse files Browse the repository at this point in the history
[backend] Fixed an issue where user authentication SQLAlchemy query was not correct, resulting in a user being able to login with a wrong password
[backend] Fixed an issue where alembic config file would overlap existing loggers configured
  • Loading branch information
joaovitoriasilva committed Feb 14, 2024
1 parent 85be8ca commit 0bc1e0a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
if config.attributes.get('configure_logger', True):
fileConfig(config.config_file_name)

# add your model's MetaData object here
Expand Down
2 changes: 1 addition & 1 deletion backend/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

# Constant related to version
API_VERSION="v0.1.4"
API_VERSION="v0.1.5"

# JWT Token constants
JWT_ALGORITHM = os.environ.get("ALGORITHM")
Expand Down
2 changes: 1 addition & 1 deletion backend/crud/crud_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def authenticate_user(username: str, password: str, db: Session):
user = (
db.query(models.User)
.filter(
models.User.username == username and models.User.password == password
models.User.username == username, models.User.password == password
)
.first()
)
Expand Down
2 changes: 2 additions & 0 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def startup_event():

# Run Alembic migrations to ensure the database is up to date
alembic_cfg = Config("alembic.ini")
# Disable the logger configuration in Alembic to avoid conflicts with FastAPI
alembic_cfg.attributes['configure_logger'] = False
command.upgrade(alembic_cfg, "head")

# Create a scheduler to run background jobs
Expand Down
2 changes: 1 addition & 1 deletion frontend/inc/Template-Bottom.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
} else { ?>2023 -
<?php echo date("Y");
} ?> Endurain • <a href="https://github.com/joaovitoriasilva/endurain"
role="button"><i class="fa-brands fa-github"></i></a> • <a href="https://fosstodon.org/@endurain"><i class="fa-brands fa-mastodon"></i></a> • v0.1.4
role="button"><i class="fa-brands fa-github"></i></a> • <a href="https://fosstodon.org/@endurain"><i class="fa-brands fa-mastodon"></i></a> • v0.1.5
</p>
<p class="text-center text-muted"><img src="../img/strava/api_logo_cptblWith_strava_horiz_light.png"
alt="Compatible with STRAVA image" height="25" /></p>
Expand Down

0 comments on commit 0bc1e0a

Please sign in to comment.