Skip to content

Commit

Permalink
Pycognito fixes (capless#93)
Browse files Browse the repository at this point in the history
* Pycognito fixes

admin_create_user with additional_kwargs
admin_reset_password typo fix

* Black fixes

passing black

* Update __init__.py
  • Loading branch information
idoseemplicity committed Nov 29, 2021
1 parent ac62bb3 commit a7e22f4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pycognito/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,22 +576,31 @@ def admin_get_user(self, attr_map=None):
)

def admin_create_user(
self, username, temporary_password="", attr_map=None, **kwargs
self,
username,
temporary_password="",
additional_kwargs=None,
attr_map=None,
**kwargs,
):
"""
Create a user using admin super privileges.
:param username: User Pool username
:param temporary_password: The temporary password to give the user.
Leave blank to make Cognito generate a temporary password for the user.
:param additional_kwargs: Dictionary with request params, such as MessageAction.
:param attr_map: Attribute map to Cognito's attributes
:param kwargs: Additional User Pool attributes
:return response: Response from Cognito
"""
if additional_kwargs is None:
additional_kwargs = {}
response = self.client.admin_create_user(
UserPoolId=self.user_pool_id,
Username=username,
UserAttributes=dict_to_cognito(kwargs, attr_map),
TemporaryPassword=temporary_password,
**additional_kwargs,
)
kwargs.update(username=username)
self._set_attributes(response, kwargs)
Expand Down Expand Up @@ -656,7 +665,7 @@ def admin_reset_password(self, username, client_metadata=None):
self.client.admin_reset_user_password(
UserPoolId=self.user_pool_id,
Username=username,
ClientMetatada=client_metadata,
ClientMetadata=client_metadata,
)

def confirm_forgot_password(self, confirmation_code, password):
Expand Down

0 comments on commit a7e22f4

Please sign in to comment.