Commit 19ffe635eccf8a0ebbf8f2a6d489a1b4a4893b57
1 parent
cab247c9
Exists in
master
and in
1 other branch
- fixed initdb.py to set empty passwords by default
Showing
1 changed file
with
6 additions
and
3 deletions
Show diff stats
initdb.py
| ... | ... | @@ -83,9 +83,12 @@ def get_students_from_csv(filename): |
| 83 | 83 | # replace password by hash for a single student |
| 84 | 84 | def hashpw(student, pw=None): |
| 85 | 85 | print('.', end='', flush=True) |
| 86 | - pw = (pw or student.get('pw', None) or student['uid']).encode('utf-8') | |
| 87 | - student['pw'] = bcrypt.hashpw(pw, bcrypt.gensalt()) | |
| 88 | - | |
| 86 | + # pw = (pw or student.get('pw', None) or student['uid']).encode('utf-8') | |
| 87 | + if pw is None: | |
| 88 | + student['pw'] = '' | |
| 89 | + else: | |
| 90 | + student['pw'] = bcrypt.hashpw(pw.encode('utf-8'), bcrypt.gensalt()) | |
| 91 | + | |
| 89 | 92 | |
| 90 | 93 | # =========================================================================== |
| 91 | 94 | def insert_students_into_db(session, students): | ... | ... |