diff --git a/initdb.py b/initdb.py index 0f78dd4..94e7057 100755 --- a/initdb.py +++ b/initdb.py @@ -83,9 +83,12 @@ def get_students_from_csv(filename): # replace password by hash for a single student def hashpw(student, pw=None): print('.', end='', flush=True) - pw = (pw or student.get('pw', None) or student['uid']).encode('utf-8') - student['pw'] = bcrypt.hashpw(pw, bcrypt.gensalt()) - + # pw = (pw or student.get('pw', None) or student['uid']).encode('utf-8') + if pw is None: + student['pw'] = '' + else: + student['pw'] = bcrypt.hashpw(pw.encode('utf-8'), bcrypt.gensalt()) + # =========================================================================== def insert_students_into_db(session, students): -- libgit2 0.21.2