#NEWLINE# @ classmethod #NEWLINE# def create_user_accounts( cls , email , password , public_ip , keyname , clear_datastore ) : #NEWLINE# #INDENT# "Registers two new user accounts with the UserAppServer.\n\n    One account is the standard account that users log in with (via their\n    e-mail address. The other is their XMPP account, so that they can log into\n    any jabber-compatible service and send XMPP messages to their application\n    (and receive them).\n\n    Args:\n      email: The e-mail address that should be registered for the user's\n        standard account.\n      password: The password that should be used for both the standard and XMPP\n        accounts.\n      public_ip: The location where the AppController can be found.\n      keyname: The name of the SSH keypair used for this AppScale deployment.\n      clear_datastore: A bool that indicates if we expect the datastore to be\n        emptied, and thus not contain any user accounts.\n    " #NEWLINE# acc = AppControllerClient ( public_ip , LocalState . get_secret_key ( keyname ) ) #NEWLINE# encrypted_pass = LocalState . encrypt_password ( email , password ) #NEWLINE# if ( ( not clear_datastore ) and acc . does_user_exist ( email ) ) : #NEWLINE# #INDENT# AppScaleLogger . log ( 'User {0} already exists, so not creating it again.' . format ( email ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# acc . create_user ( email , encrypted_pass ) #NEWLINE# #UNINDENT# username_regex = re . compile ( '\\A(.*)@' ) #NEWLINE# username = username_regex . match ( email ) . groups ( ) [ 0 ] #NEWLINE# xmpp_user = '{0}@{1}' . format ( username , LocalState . get_login_host ( keyname ) ) #NEWLINE# xmpp_pass = LocalState . encrypt_password ( xmpp_user , password ) #NEWLINE# if ( ( not clear_datastore ) and acc . does_user_exist ( xmpp_user ) ) : #NEWLINE# #INDENT# AppScaleLogger . log ( 'XMPP User {0} already exists, so not creating it again.' . format ( xmpp_user ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# acc . create_user ( xmpp_user , xmpp_pass ) #NEWLINE# #UNINDENT# AppScaleLogger . log ( 'Your XMPP username is {0}' . format ( xmpp_user ) )