handle password the correct way

This commit is contained in:
Pierre-antoine Comby 2020-02-23 14:23:02 +01:00
parent efe32e45bf
commit 889ddc15f8
1 changed files with 7 additions and 3 deletions

View File

@ -62,14 +62,20 @@ class Command(BaseCommand):
for row in cur:
row["idbde"] += 7 # do not overwrite the already populated id.
if row["type"] == "personne":
#sanitize password
if row["passwd"] != "*|*":
passwd_nk15 = "$".join(["custom_nk15","1",row["passwd"]])
else:
passwd_nk15 = ''
try:
user = User.objects.create(
username =row["pseudo"],
password = row["passwd"] if row["passwd"] != '*|*' else '',
password = passwd_nk15,
first_name = row["nom"],
last_name = row["prenom"],
email = row["mail"],
)
#sanitize duplicate aliases (nk12)
except ValidationError as e:
if e.code == 'same_alias':
user = User.objects.create(
@ -79,8 +85,6 @@ class Command(BaseCommand):
last_name = row["prenom"],
email = row["mail"],
)
profile = Profile.objects.create(
phone_number = row["tel"],
address = row["adresse"],