Change username behavior

This commit is contained in:
Aaron Lee 2021-09-15 19:30:09 +08:00
parent 19dac96e30
commit ecde63333d
2 changed files with 8 additions and 8 deletions

14
app.py
View file

@ -392,13 +392,13 @@ def upload_homeroom():
for row in csv_dict: for row in csv_dict:
if row['number'] == 'password': if row['number'] == 'password':
auth.create_user_with_email_and_password( auth.create_user_with_email_and_password(
gradec + '^' + classc + "@group-attendance.fhjh.tp.edu.tw", row['name']) gradec + classc + "@group-attendance.fhjh.tp.edu.tw", row['name'])
user = auth.sign_in_with_email_and_password( user = auth.sign_in_with_email_and_password(
gradec + '^' + classc + "@group-attendance.fhjh.tp.edu.tw", row['name']) gradec + classc + "@group-attendance.fhjh.tp.edu.tw", row['name'])
db.child("Users").child(user['localId']).update({ db.child("Users").child(user['localId']).update({
"permission": 'homeroom', "permission": 'homeroom',
"username": gradec + '^' + classc, "username": gradec + classc,
"homeroom": gradec + '^' + classc "homeroom": gradec + classc
}) })
else: else:
db.child("Homerooms").child(gradec).child( db.child("Homerooms").child(gradec).child(
@ -434,12 +434,12 @@ def upload_gp_classes():
db.child("Classes").child("GP_Class").child(csv_dict.columns[i+1]).child("Class").child( db.child("Classes").child("GP_Class").child(csv_dict.columns[i+1]).child("Class").child(
tmp_csv[j]).child("name").set(tmp_csv[j+1] + " : " + tmp_csv[j+2] + " (" + tmp_csv[j+3] + ")") tmp_csv[j]).child("name").set(tmp_csv[j+1] + " : " + tmp_csv[j+2] + " (" + tmp_csv[j+3] + ")")
auth.create_user_with_email_and_password( auth.create_user_with_email_and_password(
csv_dict.columns[i+1] + "^" + tmp_csv[j] + "@group-attendance.fhjh.tp.edu.tw", tmp_csv[j+4]) tmp_csv[j] + "@group-attendance.fhjh.tp.edu.tw", tmp_csv[j+4])
user = auth.sign_in_with_email_and_password( user = auth.sign_in_with_email_and_password(
csv_dict.columns[i+1] + "^" + tmp_csv[j] + "@group-attendance.fhjh.tp.edu.tw", tmp_csv[j+4]) tmp_csv[j] + "@group-attendance.fhjh.tp.edu.tw", tmp_csv[j+4])
db.child("Users").child(user['localId']).update({ db.child("Users").child(user['localId']).update({
"permission": 'group', "permission": 'group',
"username": csv_dict.columns[i+1] + "^" + tmp_csv[j], "username": tmp_csv[j],
"class": { "class": {
csv_dict.columns[i+1]: tmp_csv[j], csv_dict.columns[i+1]: tmp_csv[j],
} }

View file

@ -140,7 +140,7 @@
Homeroom Teacher Already Confirmed | 班導已確認</button> Homeroom Teacher Already Confirmed | 班導已確認</button>
{% else %} {% else %}
<button class="btn btn-primary margin-top afterSelButton" onclick="homeroomCfrm()">Homeroom <button class="btn btn-primary margin-top afterSelButton" onclick="homeroomCfrm()">Homeroom
Teacher Confirm | 班導確認</button> Teacher Confirm | 班導確認</button>
{% endif %} {% endif %}
<div id="finalCheck" hidden="hidden"> <div id="finalCheck" hidden="hidden">
<!-- show warning --> <!-- show warning -->