mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-07 22:36:02 +00:00
feat: Add configurable password change toggle via system.allow_change_password (#1869)
* Initial plan * Add password change toggle feature with config flag Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com> * Feature implementation complete and validated Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com> * chore: remove lock --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com> Co-authored-by: Junyan Qin <rockchinq@gmail.com>
This commit is contained in:
@@ -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
|
||||
),
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -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']
|
||||
|
||||
Reference in New Issue
Block a user