On 9/18/18 6:30 PM, Dmitry Makovey wrote:
On 09/18/2018 09:22 AM, Abhilash Raj wrote:
I think I am asking about the username/password auth for postorious and how to dump/restore it. At present we have no tools for dump/restoring users so that's what we're trying to build. Ah, why not take a database dump? There are a few specific tables that you can dump to get everything?
We don't have a way to do that because we do not actually do not handle auth ourselves, but instead delegate it to allauth library. You may have to dig into internals of that to be able to fetch/restore users/passwords. Thanks for picking up the thread, Abhilash.
Since we're trying to get solution that would allow us to dump/restore members/users of specific mailing list etc. we need a bit more "precise" method of extracting user info. We also suspect our DB could be corrupt (we have multiple address entries per member, of which 1 would have proper address and the rest are with empty fields, what's more the ones referenced from other tables are mainly those with empty fields) thus would like to dump "clean" objects and refresh DB rather than copy corruption from DB to DB.
You are in Django territory, so I would suggest using django to get the job done.
You can write your own python scripts that do that for you, you could even use the django management commands
https://docs.djangoproject.com/en/2.1/howto/custom-management-commands/
You should be able to retrieve users
from django.contrib.auth.models import User
users = User.objects.all()
user = users[0]
user.password = 'passwordHash'
user.save()
That should set the password properly.
If you need further help, the django docs are quite good, but if you need anything I'm happy to help
cheers,
Simon