Retrieve object model admin userid & password?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Retrieve object model admin userid & password?

Marc Edwards
I am working through some authentication examples.

When I created my first database, I "recall" entering a username and
password, but entering what I recall was the correct input is not
authenticating.

Is there an easy way to reset or retrieve the username and password
that was used to create the object model?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Retrieve object model admin userid & password?

Tim Sawyer-6
You can't retrieve the password, as that would be a security flaw.  The
security works by hashing the password entered into the login form, and
comparing the hashed version with the one stored on the database.  Hash
functions are quick to run one way, but difficult to reverse, hence it's
difficult to get back the password used.

You can reset a users password in the admin site - login to admin, open
the user up, then use the change password link next to the user's
password field.

This, of course, supposes that the password you've forgotten isn't the
only admin password.  If it is, then you could delete the row from the
auth_user database table and do a syncdb - that should prompt you to
create a superuser, if I recall correctly.

HTH,

Tim.

On 30/11/11 18:10, Marc Edwards wrote:
> I am working through some authentication examples.
>
> When I created my first database, I "recall" entering a username and
> password, but entering what I recall was the correct input is not
> authenticating.
>
> Is there an easy way to reset or retrieve the username and password
> that was used to create the object model?
>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Reply | Threaded
Open this post in threaded view
|

Re: Retrieve object model admin userid & password?

Ian Clelland-2
On Wed, Nov 30, 2011 at 10:22 AM, Tim Sawyer <[hidden email]> wrote:
You can't retrieve the password, as that would be a security flaw.  The security works by hashing the password entered into the login form, and comparing the hashed version with the one stored on the database.  Hash functions are quick to run one way, but difficult to reverse, hence it's difficult to get back the password used.

You can reset a users password in the admin site - login to admin, open the user up, then use the change password link next to the user's password field.

This, of course, supposes that the password you've forgotten isn't the only admin password.  If it is, then you could delete the row from the auth_user database table and do a syncdb - that should prompt you to create a superuser, if I recall correctly.

Yes, yes and yes.

If you have console access, you can also do this:

manage.py changepassword username_goes_here

That will allow you to reset anybody's password; superuser or otherwise.

-- 
Regards,
Ian Clelland
<[hidden email]>

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.