Is it possible to implement an equivalent o开发者_JS百科f sudo
for Django profiles ? I'm using the basic authentication system django.contrib.auth
.
Usecase: Sometimes, users report bugs which are only reproductible in their profile, so, each time, I change their password, log in, fix the bug and replaces the password with the original one.
I tried to implement this feature by using login()
but it requires a call to authenticate()
in the first place which is not an option because we don't have the password in clear text, just the hashed one.
Is there any clever way to do that? Except messing up with the user's password?
Thanks!
Djangosnippets.org is your friend: http://www.djangosnippets.org/snippets/1590/
I knocked up a user panel in the debug toolbar. It works well for flipping logged in users around . The fork is here.
http://github.com/mjbrownie/django-debug-toolbar
it also displays some basic user group permission info. I didn't get around to expanding it.
you could borrow the logic so it doesn't have to run in debug mode.
Edit: This post and plugin is old and no longer maintained. It looks like someone has independently created this however.
https://github.com/playfire/django-debug-toolbar-user-panel
精彩评论