mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 06:24:23 +01:00
Invalidate any previously cached attributes on user login
This commit is contained in:
12
tests/cache/test_cache.py
vendored
12
tests/cache/test_cache.py
vendored
@@ -28,18 +28,6 @@ def test_clear_user_session():
|
||||
user.type = "admin"
|
||||
app.db.session.commit()
|
||||
|
||||
# The user shouldn't be considered admin because their type is still cached
|
||||
user = Users.query.filter_by(id=2).first()
|
||||
with app.test_request_context("/"):
|
||||
login_user(user)
|
||||
user = get_current_user()
|
||||
assert user.id == 2
|
||||
assert user.type == "admin"
|
||||
assert is_admin() is False
|
||||
|
||||
# Clear the user's cached session (for now just the type)
|
||||
clear_user_session(user_id=2)
|
||||
|
||||
# The user's type should now be admin
|
||||
user = Users.query.filter_by(id=2).first()
|
||||
with app.test_request_context("/"):
|
||||
|
||||
Reference in New Issue
Block a user