zhaoqingang
2025-02-25 ac9373fd6f0db53c983d87c4790cb627e82759e9
app/api/user.py
@@ -23,14 +23,14 @@
async def add_user(user: UserInfo, current_user: UserModel = Depends(get_current_user), db=Depends(get_db)):
    if not user.userName:
        return Response(code=400, msg="The userName cannot be empty!")
    if "@" in user.username:
    if "@" in user.userName:
        return Response(code=400, msg="Username cannot contain @")
    if user.pwd:
        if not is_valid_password(user.pwd):
            return Response(code=400, msg="The password must be at least 8 and contain both numbers and letters")
    db_user = db.query(UserModel).filter(UserModel.username == user.userName, UserModel.status != USER_STATSU_DELETE).first()
    if db_user:
        return Response(code=200, msg="user already created")
        return Response(code=400, msg="user already created")
    pwd = user.pwd
    if not pwd:
        pwd = "basic123456"