From b894842736bbf5f8d328529882044d8871dce304 Mon Sep 17 00:00:00 2001 From: RockChinQ Date: Wed, 8 Apr 2026 19:02:36 +0800 Subject: [PATCH] fix(user): allow password login and password change for Space accounts with local password set Previously, Space accounts were unconditionally blocked from password login and password change based on account_type. Now the check verifies whether the user actually has a local password set, allowing Space users who have set a local password to authenticate and change it normally. --- src/langbot/pkg/api/http/service/user.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/langbot/pkg/api/http/service/user.py b/src/langbot/pkg/api/http/service/user.py index 162b0d08..80198a3c 100644 --- a/src/langbot/pkg/api/http/service/user.py +++ b/src/langbot/pkg/api/http/service/user.py @@ -65,8 +65,8 @@ class UserService: user_obj = result_list[0] - # Check if this is a Space account - if user_obj.account_type == 'space': + # Check if this user has a local password set + if not user_obj.password: raise ValueError('请使用 Space 账户登录') ph = argon2.PasswordHasher() @@ -108,9 +108,8 @@ class UserService: if user_obj is None: raise ValueError('User not found') - # Space accounts cannot change password locally - if user_obj.account_type == 'space': - raise ValueError('Space account cannot change password locally') + if not user_obj.password: + raise ValueError('No local password set, please set a password first') ph.verify(user_obj.password, current_password)