mirror of
https://github.com/simple-login/app.git
synced 2024-09-29 21:21:29 +02:00
fix delete user profile picture
This commit is contained in:
parent
84e64d4c4f
commit
86636b2eb7
@ -54,11 +54,12 @@ def update_user_info():
|
|||||||
if "profile_picture" in data:
|
if "profile_picture" in data:
|
||||||
if data["profile_picture"] is None:
|
if data["profile_picture"] is None:
|
||||||
if user.profile_picture_id:
|
if user.profile_picture_id:
|
||||||
|
user.profile_picture_id = None
|
||||||
|
db.session.flush()
|
||||||
|
|
||||||
file = user.profile_picture
|
file = user.profile_picture
|
||||||
File.delete(file.id)
|
File.delete(file.id)
|
||||||
s3.delete(file.path)
|
s3.delete(file.path)
|
||||||
|
|
||||||
user.profile_picture_id = None
|
|
||||||
else:
|
else:
|
||||||
raw_data = base64.decodebytes(data["profile_picture"].encode())
|
raw_data = base64.decodebytes(data["profile_picture"].encode())
|
||||||
file_path = random_string(30)
|
file_path = random_string(30)
|
||||||
|
Loading…
Reference in New Issue
Block a user