Finish changing storage file name

This commit is contained in:
Aaron Lee 2021-09-26 12:19:11 +08:00
parent ab40bcfa26
commit 7254fed8a1

2
app.py
View file

@ -386,7 +386,7 @@ def homeroom_confirm():
signature = request.form['signatureData'] signature = request.form['signatureData']
signature = signature.removeprefix('data:image/png;base64,') signature = signature.removeprefix('data:image/png;base64,')
signature = bytes(signature, 'utf-8') signature = bytes(signature, 'utf-8')
rand = str(randint(100000000000000, 999999999999999)) rand = str(date + '^' + homeroom[0] + '^' + homeroom[1] + '^' + 'hrCfrm')
rand += ".png" rand += ".png"
with open(os.path.join('temp', rand), "wb") as fh: with open(os.path.join('temp', rand), "wb") as fh:
fh.write(base64.decodebytes(signature)) fh.write(base64.decodebytes(signature))