From 32dd9347da3e00ad3e79c7e452a606160e9300db Mon Sep 17 00:00:00 2001
From: Carlos Vega <carlos.vega@uni.lu>
Date: Wed, 7 Nov 2018 10:46:41 +0100
Subject: [PATCH] ask the user for a password

---
 smash/import_file.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/smash/import_file.py b/smash/import_file.py
index c7c08e69..00de3e19 100644
--- a/smash/import_file.py
+++ b/smash/import_file.py
@@ -1,5 +1,6 @@
 # coding=utf-8
 import os
+import getpass
 import django
 from django.conf import settings
 os.environ.setdefault("DJANGO_SETTINGS_MODULE", "smash.settings")
@@ -497,8 +498,7 @@ def parse_row(index, row, visit_columns, appointmentTypes, voucher_types):
                 minutes=appointment_type.default_duration)
             app_type_link.save()
 
-def createWorker(username='admin', email='carlos.vega@uni.lu', 
-    password='pdptestpassword1234', first_name='LCSB', last_name='Admin',
+def createWorker(password, email='', username='admin', first_name='LCSB', last_name='Admin',
     specialization='Technician', unit='LCSB'):
 
         # create user
@@ -571,4 +571,11 @@ if __name__ == '__main__':
     for index, row in df.iterrows():
         parse_row(index, row, visit_columns, appointmentTypes, voucher_types)
     #create worker and super user
-    createWorker()
\ No newline at end of file
+    pass1 = ''
+    pass2 = None
+    while pass1 != pass2:
+        pass1 = getpass.getpass('Please type a password for the Admin user: ')
+        pass2 = getpass.getpass('Please type your password again: ')
+        if pass1 != pass2:
+            print 'Password mismatch, please try again'
+    createWorker(pass1)
\ No newline at end of file
-- 
GitLab