Explorar o código

add 修改加密部分

zooey hai 1 ano
pai
achega
24e556d7ba
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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()