I'm creating a control panel where the superuser can view a table of all users along with their info. I want to add the users passwords to a column, and a link to an edit form to change the password.
Asked
Active
Viewed 234 times
-1
-
why not using django admin, do you hate the style?? [CHANGE IT](https://stackoverflow.com/questions/7357057/overriding-admin-css-in-django)! – mohammedgqudah Nov 21 '17 at 17:49
-
Django admin allows to reset password, but it doesn't display it: its just a hash. – C. Red. Nov 21 '17 at 17:55
-
3Django only stores the hash. It's not possible to display the original passwords. – Alasdair Nov 21 '17 at 18:53
1 Answers
0
let say you have list_passwords
view where you send super user can view passwords
from django.views.decorators.http import require_http_methods
@require_http_methods(['GET'])
def list_password(request):
if not request.user.is_superuser:
# return with error
else:
# return data
Another view to update password
@require_http_methods(['PATCH'])
def update_password(request):
if not request.user.is_superuser:
# return with error
else:
# update user password

navyad
- 3,752
- 7
- 47
- 88