1

Maybe I am doing something wrong but I would like to create data for my Django app tests and first, I would like to create users using sql script in DB Browser SQLite

   INSERT INTO
   auth_user (date_joined, username, first_name, last_name, email, is_active, is_superuser, is_staff, password) 
VALUES
   (
      DateTime('now'), 'Hamilton', 'Laird', 'Hamilton', 'laird.hamilton@surf.com', 1, 0, 0, 'mereva2019'
   )
;

but as password is not encrypted it does not work is there a way to correctly encrypted password?

what would be the good way to do that?

Dalvtor
  • 3,160
  • 3
  • 21
  • 36
SLATER
  • 613
  • 9
  • 31

2 Answers2

0

The password isn't stored in plaintext; it has to be encrypted. I used this code in the Django shell:

from django.contrib.auth.models import User
user = Users.objects.get(username='myuser')
user.set_password('mypassword')
user.save()
Dashdrum
  • 657
  • 1
  • 4
  • 9
-1

Well, you can use SQLCipher which is password management tool

As per its description

SQLCipher is an extension to SQLite that provides transparent 256-bit AES encryption of database files. Pages are encrypted before being written to disk and are decrypted when read back.

You can find more content on below site.

https://www.zetetic.net/sqlcipher/

Abra
  • 19,142
  • 7
  • 29
  • 41
Raj Paliwal
  • 943
  • 1
  • 9
  • 22