fix password

This commit is contained in:
long2ice
2020-07-29 16:02:35 +08:00
parent 999d8517fa
commit cc3c29db21

View File

@@ -24,8 +24,8 @@ async def handle_m2m_fields_create_or_update(
for k, v in body.items():
if k in m2m_fields:
m2m_body[k] = copy_body.pop(k)
password = copy_body.pop("password", None)
if model == user_model and not create:
password = copy_body.get("password")
user = await user_model.get(pk=pk)
if user.password != password:
copy_body["password"] = pwd_context.hash(password)