From 247038b7ee75997c1a9ae1a7472e5eb5023bc9e8 Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期三, 19 二月 2025 14:37:09 +0800
Subject: [PATCH] commit

---
 app/api/auth.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/api/auth.py b/app/api/auth.py
index 1de0449..abb3474 100644
--- a/app/api/auth.py
+++ b/app/api/auth.py
@@ -170,7 +170,10 @@
 
 @router.post("/v2/register", response_model=Response)
 async def register_v2(user: UserCreate, db=Depends(get_db)):
-    if not is_valid_password(user.password):
+    if "@" in user.username:
+        return Response(code=400, msg="Username cannot contain @")
+    password = await password_rsa(user.password)
+    if not is_valid_password(password):
         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).first()
     if db_user:
@@ -201,7 +204,7 @@
             register_dict[app['id']] = {"id":register_info.get("id"), "name": name, "email": register_info.get("email")}
         except Exception as e:
             return Response(code=500, msg=f"Failed to register with {app['id']}: {str(e)}")
-    user_id = await save_register_user(db, user.username, user.password, user.email, app_password, register_dict)
+    user_id = await save_register_user(db, user.username, password, user.email, app_password, register_dict)
     if not user_id:
         return Response(code=500, msg=f"Failed to register with app")
     return Response(code=200, msg="User registered successfully",data={"userFlag": user_id})

--
Gitblit v1.8.0