Skip to content

Commit

Permalink
fix: Handle non-ASCII characters in username comparison (viur-framewo…
Browse files Browse the repository at this point in the history
…rk#1112)

Login causes error 500 when e.g. umlauts are being used.
  • Loading branch information
phorward authored Mar 19, 2024
1 parent cf4ce9b commit 82736b6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

This file documents any relevant changes done to ViUR-core since version 3.

## [3.5.17]

- fix: Handle non-ASCII characters in username comparison (#1112)

## [3.5.16]

- chore: Dependency updates
Expand Down
2 changes: 1 addition & 1 deletion src/viur/core/modules/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def login(self, *, name: str | None = None, password: str | None = None, **kwarg

# Check if the username matches
stored_user_name = (user_entry.get("name") or {}).get("idx") or ""
is_okay = secrets.compare_digest(stored_user_name, name)
is_okay = secrets.compare_digest(stored_user_name.encode(), name.encode())

# Check if the password matches
stored_password_hash = password_data.get("pwhash", b"-invalid-")
Expand Down
2 changes: 1 addition & 1 deletion src/viur/core/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# This will mark it as a pre-release as well on PyPI.
# See CONTRIBUTING.md for further information.

__version__ = "3.5.16"
__version__ = "3.5.17"

assert __version__.count(".") >= 2 and "".join(__version__.split(".", 3)[:3]).isdigit(), \
"Semantic __version__ expected!"

0 comments on commit 82736b6

Please sign in to comment.