Skip to content

Commit

Permalink
feat: audit for password modification TencentBlueKing#289
Browse files Browse the repository at this point in the history
  • Loading branch information
Canway-shiisa committed Mar 21, 2022
1 parent 18a4122 commit 76ac091
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/saas/bkuser_shell/password/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,12 @@ def reset_by_token(self, request, validated_data):
# 由于该接口无登录态,我们只能认为访问该链接的人即用户所有者
request.user.username = profile.username

profiles_api_instance = bkuser_sdk.ProfilesApi(self.get_api_client_by_request(request))
profiles_api_instance = bkuser_sdk.ProfilesApi(self.get_api_client_by_request(request, user_from_token=True))
body = {"password": password}

# 调用后台接口重置密码
profiles_api_instance.v2_profiles_partial_update(
lookup_value=profile.id, body=body, lookup_field="id", user_from_token=True
)
lookup_value=profile.id, body=body, lookup_field="id")

return Response(data={})

Expand Down
9 changes: 2 additions & 7 deletions src/sdk/bkuser_sdk/api/profiles_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
蓝鲸用户管理后台服务 API # noqa: E501
OpenAPI spec version: v2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

Expand Down Expand Up @@ -911,12 +911,11 @@ def v2_profiles_partial_update_with_http_info(self, body, lookup_value, **kwargs
returns the request thread.
"""

all_params = ['body', 'lookup_value', 'fields', 'lookup_field', 'include_disabled', 'user_from_token'] # noqa: E501
all_params = ['body', 'lookup_value', 'fields', 'lookup_field', 'include_disabled'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
all_params.append('user_from_token')

params = locals()
for key, val in six.iteritems(params['kwargs']):
Expand Down Expand Up @@ -966,10 +965,6 @@ def v2_profiles_partial_update_with_http_info(self, body, lookup_value, **kwargs
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501

if 'user_from_token' in params:
header_params['user-from-token'] = params["user_from_token"]


# Authentication setting
auth_settings = [] # noqa: E501

Expand Down

0 comments on commit 76ac091

Please sign in to comment.