Browse Source

suhh-修改账号登录默认密码

‘suhuihui’ 2 months ago
parent
commit
68a5f9ec61
2 changed files with 3 additions and 15 deletions
  1. 0 2
      api/controllers/console/workspace/members.py
  2. 3 13
      api/services/account_service.py

+ 0 - 2
api/controllers/console/workspace/members.py

@@ -53,10 +53,8 @@ class MemberInviteEmailApi(Resource):
 
 
         inviter = current_user
         inviter = current_user
         invitation_results = []
         invitation_results = []
-        print("打印1:")
         console_web_url = dify_config.CONSOLE_WEB_URL
         console_web_url = dify_config.CONSOLE_WEB_URL
         for invitee_email in invitee_emails:
         for invitee_email in invitee_emails:
-            print("打印5:")
             try:
             try:
                 token = RegisterService.invite_new_member(
                 token = RegisterService.invite_new_member(
                     inviter.current_tenant, invitee_email, interface_language, role=invitee_role, inviter=inviter
                     inviter.current_tenant, invitee_email, interface_language, role=invitee_role, inviter=inviter

+ 3 - 13
api/services/account_service.py

@@ -225,7 +225,7 @@ class AccountService:
         account = Account()
         account = Account()
         account.email = email
         account.email = email
         account.name = name
         account.name = name
-        password = email
+        password = "Szka&2@25"
         if account.password is None:
         if account.password is None:
             # generate password salt
             # generate password salt
             salt = secrets.token_bytes(16)
             salt = secrets.token_bytes(16)
@@ -236,8 +236,8 @@ class AccountService:
 
 
             account.password = base64_password_hashed
             account.password = base64_password_hashed
             account.password_salt = base64_salt
             account.password_salt = base64_salt
-        print("新注册账号密码:" + account.password)
-        print("新注册账号密码:" + account.password_salt)
+        #print("新注册账号密码:" + account.password)
+        #print("新注册账号密码:" + account.password_salt)
         account.interface_language = interface_language
         account.interface_language = interface_language
         account.interface_theme = interface_theme
         account.interface_theme = interface_theme
 
 
@@ -662,7 +662,6 @@ class TenantService:
     @staticmethod
     @staticmethod
     def create_tenant_member(tenant: Tenant, account: Account, role: str = "normal") -> TenantAccountJoin:
     def create_tenant_member(tenant: Tenant, account: Account, role: str = "normal") -> TenantAccountJoin:
         """Create tenant member"""
         """Create tenant member"""
-        print("打印4:")
         if role == TenantAccountRole.OWNER.value:
         if role == TenantAccountRole.OWNER.value:
             if TenantService.has_roles(tenant, [TenantAccountRole.OWNER]):
             if TenantService.has_roles(tenant, [TenantAccountRole.OWNER]):
                 logging.error(f"Tenant {tenant.id} has already an owner.")
                 logging.error(f"Tenant {tenant.id} has already an owner.")
@@ -709,7 +708,6 @@ class TenantService:
         # Ensure tenant_id is provided
         # Ensure tenant_id is provided
         if tenant_id is None:
         if tenant_id is None:
             raise ValueError("Tenant ID must be provided.")
             raise ValueError("Tenant ID must be provided.")
-        print("打印4:")
         tenant_account_join = (
         tenant_account_join = (
             db.session.query(TenantAccountJoin)
             db.session.query(TenantAccountJoin)
             .join(Tenant, TenantAccountJoin.tenant_id == Tenant.id)
             .join(Tenant, TenantAccountJoin.tenant_id == Tenant.id)
@@ -973,9 +971,7 @@ class RegisterService:
         """Invite new member"""
         """Invite new member"""
         with Session(db.engine) as session:
         with Session(db.engine) as session:
             account = session.query(Account).filter_by(email=email).first()
             account = session.query(Account).filter_by(email=email).first()
-        print("打印2:")
         if not account:
         if not account:
-            print("打印3:")
             TenantService.check_member_permission(tenant, inviter, None, "add")
             TenantService.check_member_permission(tenant, inviter, None, "add")
             name = email.split("@")[0]
             name = email.split("@")[0]
 
 
@@ -986,21 +982,16 @@ class RegisterService:
             TenantService.create_tenant_member(tenant, account, role)
             TenantService.create_tenant_member(tenant, account, role)
             TenantService.switch_tenant(account, tenant.id)
             TenantService.switch_tenant(account, tenant.id)
         else:
         else:
-            print("打印6:")
             TenantService.check_member_permission(tenant, inviter, account, "add")
             TenantService.check_member_permission(tenant, inviter, account, "add")
             ta = TenantAccountJoin.query.filter_by(tenant_id=tenant.id, account_id=account.id).first()
             ta = TenantAccountJoin.query.filter_by(tenant_id=tenant.id, account_id=account.id).first()
 
 
             if not ta:
             if not ta:
-                print("打印7:")
                 TenantService.create_tenant_member(tenant, account, role)
                 TenantService.create_tenant_member(tenant, account, role)
 
 
             # Support resend invitation email when the account is pending status
             # Support resend invitation email when the account is pending status
             if account.status != AccountStatus.PENDING.value:
             if account.status != AccountStatus.PENDING.value:
-                print("打印8:")
                 raise AccountAlreadyInTenantError("Account already in tenant.")
                 raise AccountAlreadyInTenantError("Account already in tenant.")
-        print("打印9:")
         token = cls.generate_invite_token(tenant, account)
         token = cls.generate_invite_token(tenant, account)
-        print("打印10:")
         # send email
         # send email
         send_invite_member_mail_task.delay(
         send_invite_member_mail_task.delay(
             language=account.interface_language,
             language=account.interface_language,
@@ -1009,7 +1000,6 @@ class RegisterService:
             inviter_name=inviter.name if inviter else "Dify",
             inviter_name=inviter.name if inviter else "Dify",
             workspace_name=tenant.name,
             workspace_name=tenant.name,
         )
         )
-        print("打印11:")
         return token
         return token
 
 
     @classmethod
     @classmethod