-
-
Notifications
You must be signed in to change notification settings - Fork 803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove anonymous user #698
Comments
Agree; this wouldn't technically remove any functionality, but it would reduce cognitive overhead. I'm in favor of that. It's probably worth documenting how anonymous users can be implemented via |
I think this issue is about 3 independent (sub)issues, that might be better to address separately. Let me explain:
NB, docs state:
So users are explicitly told, that this is the default object. If a user is confused, she just haven't read or understood the docs and in a case of a library that handles app security this is a thing that leads to security issues down the road. So maybe it's a lesser evil. All in all, as proposed, the easiest solution to part 3 would be to just not store the Also the documentation does not provide any clues on how to use |
I don't care about breaking changes in this case, because of how much confusion this already causes. I'll deprecate
|
I haven't experimented yet, but my current idea to deprecate this will be to have a |
I happened to be working getting Flask-Security-Too to be compatible with this change. As a test I set: and started fixing issues :-) I never realized that is_authenticated actually looks at is_active - that might cause very subtle bugs.. need to work on that next. |
It didn't prior to 0.6. There was an issue, a PR, and then someone pointed out that it's sort of confusing now. I'd really like to simplify things like that, it seems like |
This is a constant source of confusion for users. They don't understand why
is_authenticated
is always true forUserMixin
even if it's not the logged in user. They get tripped up when they try to access attributes oncurrent_user
that aren't available onAnonymousUserMixin
.Whenever I'm writing my own quick login implementation, I set
g.user
toNone
if there's no logged in user, and thecurrent_user
proxy would be unbound (if current_user
would lookFalse
).You can return any object you want from
user_loader
. If an application needs an anonymous user system, they can return an anonymous user object fromuser_loader
. They'll most likely need that anyway as even anonymous users might take actions that need to be associated together, and a single anonymous user wouldn't work for that.I think removing this might also make it more obvious that you can return more than one type from
user_loader
, likeAdminUser
andRegularUser
for example.I realize this is a larger departure from current behavior than other refactors we've been doing. But I think it's worth doing for a simpler API.
The text was updated successfully, but these errors were encountered: