소스 검색

add 修改加密部分

zooey 2 년 전
부모
커밋
24e556d7ba
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      app/api/users.py

+ 1 - 1
app/api/users.py

@@ -71,7 +71,7 @@ async def logout():
 async def add(username: str = Form(default=''), password: str = Form(default=''), email: str = Form(default=''), re_password: str = Form(default='')):
     if username and password and email:
         if password == re_password:
-            hashed_password = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt())
+            hashed_password = bcrypt.hashpw(password.encode('utf-8'), bcrypt.gensalt()).decode('utf-8')
             u = await User.create(username=username, password=hashed_password, email=email)
             if u:
                 # send_email()