mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
feat(fastapi): render a 500 html response when unique SID generation fails
We've seen a bug in the past where unique SID generation fails and still ends up raising an exception. This commit reworks how we deal with database exceptions internally, tries for 36 iterations to set a fresh unique SID, and raises a 500 HTTPException if we were unable to. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
abfd41f31e
commit
806a19b91a
3 changed files with 85 additions and 29 deletions
|
@ -62,7 +62,6 @@ def test_user_login_logout(user: User):
|
|||
sid = user.login(request, "testPassword")
|
||||
assert sid is not None
|
||||
assert user.is_authenticated()
|
||||
assert "AURSID" in request.cookies
|
||||
|
||||
# Expect that User session relationships work right.
|
||||
user_session = db.query(Session,
|
||||
|
@ -92,7 +91,6 @@ def test_user_login_logout(user: User):
|
|||
|
||||
# Test logout.
|
||||
user.logout(request)
|
||||
assert "AURSID" not in request.cookies
|
||||
assert not user.is_authenticated()
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue