mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-18 06:24:23 +01:00
Deprecates storing user type in session (#1323)
* Deprecates storing session["type"] as a means of referring to the user's current level. Instead you should refer to the database. * Adds `CTFd.utils.user.get_current_user_type()` to get the current user's type or return None if the user is unauthed. * Closes #1279
This commit is contained in:
@@ -150,7 +150,6 @@ def register_user(
|
||||
with client.session_transaction() as sess:
|
||||
assert sess["id"]
|
||||
assert sess["name"] == name
|
||||
assert sess["type"]
|
||||
assert sess["email"]
|
||||
assert sess["nonce"]
|
||||
|
||||
@@ -178,7 +177,6 @@ def login_as_user(app, name="user", password="password", raise_for_error=True):
|
||||
with client.session_transaction() as sess:
|
||||
assert sess["id"]
|
||||
assert sess["name"]
|
||||
assert sess["type"]
|
||||
assert sess["email"]
|
||||
assert sess["nonce"]
|
||||
return client
|
||||
@@ -237,7 +235,6 @@ def login_with_mlc(
|
||||
with client.session_transaction() as sess:
|
||||
assert sess["id"]
|
||||
assert sess["name"]
|
||||
assert sess["type"]
|
||||
assert sess["email"]
|
||||
assert sess["nonce"]
|
||||
return client
|
||||
|
||||
Reference in New Issue
Block a user