@@ -285,7 +285,6 @@ def register(self, username, password, attr_map=None):
285285 :param username: User Pool username
286286 :param password: User Pool password
287287 :param attr_map: Attribute map to Cognito's attributes
288- :param kwargs: Additional User Pool attributes
289288 :return response: Response from Cognito
290289
291290 Example response::
@@ -298,16 +297,22 @@ def register(self, username, password, attr_map=None):
298297 }
299298 }
300299 """
300+ attributes = self .base_attributes .copy ()
301+ if self .custom_attributes :
302+ attributes .update (self .custom_attributes )
303+ cognito_attributes = dict_to_cognito (attributes , attr_map )
304+ params = {
305+ 'ClientId' : self .client_id ,
306+ 'Username' : username ,
307+ 'Password' : password ,
308+ 'UserAttributes' : cognito_attributes
309+ }
301310
302- attributes = dict (self .base_attributes .items () + self .custom_attributes .items ())
303- cognito_attributes = dict_to_cognito (attributes ,attr_map )
304- user_attrs = [{'Name' : key , 'Value' : value } for key , value in attributes .items ()]
305- response = self .client .sign_up (
306- ClientId = self .client_id ,
307- Username = username ,
308- Password = password ,
309- UserAttributes = cognito_attributes
310- )
311+ if self .client_secret is not None :
312+ params .update ({'SecretHash' :
313+ AWSSRP .get_secret_hash (username , self .client_id , self .client_secret )})
314+
315+ response = self .client .sign_up (** params )
311316
312317 attributes .update (username = username , password = password )
313318 self ._set_attributes (response , attributes )
0 commit comments