Reputation: 348
I am trying to build an Api with an old database, which i am trying to move in USER model at Django.
I configured table with Users for django USER model, however there is one problem. The passwords in old database are not encrypted, what means I can not log in with django.
Any ideas how to solve this? Is there a way to encrypt the column of passwords or I can pass this in django? Any help would be very welcomed. Thank you.
I am using sqlite3
Upvotes: 1
Views: 769
Reputation: 56
If you already have a database with the user data imported, you should loop through the records and hash the passwords:
for user in User.objects.all():
user.set_password(user.password)
user.save()
Upvotes: 3
Reputation: 114
Ignoring the security hazzard, I guess your only option is to call set_password for users and update the password accordingly
Upvotes: 0