SimpleUser and UnauthenticatedUser don't implement BaseUser.identity #3270
Unanswered
navidnabavi
asked this question in
Potential Issue
Replies: 1 comment 1 reply
-
|
This is a genuine gap in the built-in classes. The fix is straightforward — two property additions in class SimpleUser(BaseUser):
def __init__(self, username: str) -> None:
self.username = username
@property
def is_authenticated(self) -> bool:
return True
@property
def display_name(self) -> str:
return self.username
@property
def identity(self) -> str: # ← add this
return self.username
class UnauthenticatedUser(BaseUser):
@property
def is_authenticated(self) -> bool:
return False
@property
def display_name(self) -> str:
return ""
@property
def identity(self) -> str: # ← add this
return ""Rationale:
A PR with these two additions plus tests ( |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Bug
BaseUserdefinesidentityas an abstract property (raisesNotImplementedError).Neither
SimpleUsernorUnauthenticatedUserimplement it.Code
Beta Was this translation helpful? Give feedback.
All reactions