diff --git a/src/langbot/pkg/api/http/controller/groups/system.py b/src/langbot/pkg/api/http/controller/groups/system.py
index b5a0db80..ddbb2fda 100644
--- a/src/langbot/pkg/api/http/controller/groups/system.py
+++ b/src/langbot/pkg/api/http/controller/groups/system.py
@@ -23,6 +23,9 @@ class SystemRouterGroup(group.RouterGroup):
if 'cloud_service_url' in self.ap.instance_config.data.get('plugin', {})
else 'https://space.langbot.app'
),
+ 'allow_change_password': self.ap.instance_config.data.get('system', {}).get(
+ 'allow_change_password', True
+ ),
}
)
diff --git a/src/langbot/pkg/api/http/controller/groups/user.py b/src/langbot/pkg/api/http/controller/groups/user.py
index f1525a6b..0a5aad77 100644
--- a/src/langbot/pkg/api/http/controller/groups/user.py
+++ b/src/langbot/pkg/api/http/controller/groups/user.py
@@ -70,6 +70,13 @@ class UserRouterGroup(group.RouterGroup):
@self.route('/change-password', methods=['POST'], auth_type=group.AuthType.USER_TOKEN)
async def _(user_email: str) -> str:
+ # Check if password change is allowed
+ allow_change_password = self.ap.instance_config.data.get('system', {}).get(
+ 'allow_change_password', True
+ )
+ if not allow_change_password:
+ return self.http_status(403, -1, 'Password change is disabled')
+
json_data = await quart.request.json
current_password = json_data['current_password']
diff --git a/src/langbot/templates/config.yaml b/src/langbot/templates/config.yaml
index 5b99b135..e0e95b0b 100644
--- a/src/langbot/templates/config.yaml
+++ b/src/langbot/templates/config.yaml
@@ -16,6 +16,7 @@ proxy:
https: ''
system:
recovery_key: ''
+ allow_change_password: true
jwt:
expire: 604800
secret: ''
diff --git a/web/src/app/home/components/home-sidebar/HomeSidebar.tsx b/web/src/app/home/components/home-sidebar/HomeSidebar.tsx
index 00575a77..5083613a 100644
--- a/web/src/app/home/components/home-sidebar/HomeSidebar.tsx
+++ b/web/src/app/home/components/home-sidebar/HomeSidebar.tsx
@@ -299,24 +299,26 @@ export default function HomeSidebar({
{t('common.helpDocs')}
-
+
+ {t('common.changePassword')}
+
+ )}