| | |
| | | response = await client.get(url, headers=headers) |
| | | data = self._check_response(response) |
| | | return data |
| | | |
| | | |
| | | async def change_password_public(self, token: str, username: str, password: str, new_password:str) -> dict: |
| | | url = f"{self.base_url}/api/v1/user/change_password_public" |
| | | headers = {'cookie': f"access_token_cookie={token};"} |
| | | public_key = await self.get_public_key_api() |
| | | password = BishengCrypto(public_key, settings.PRIVATE_KEY).encrypt(password) |
| | | new_password = BishengCrypto(public_key, settings.PRIVATE_KEY).encrypt(new_password) |
| | | json = {"username": username, "password": password, "new_password": new_password} |
| | | async with httpx.AsyncClient() as client: |
| | | response = await client.post(url, headers=headers, json=json) |
| | | data = self._check_response(response) |
| | | |
| | | return data |