Commit e386fa1e authored by Ivan Tyagov's avatar Ivan Tyagov

Show message from server side user credential request creation script.

parent 7a1f0f98
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
Paramameter list : Paramameter list :
reference -- User login is mandatory (String) reference -- User login is mandatory (String)
default_email_text -- Email is mandatory (String)""" default_email_text -- Email is mandatory (String)"""
import json
# create the credential request # create the credential request
portal = context.getPortalObject() portal = context.getPortalObject()
module = portal.getDefaultModule(portal_type='Credential Request') module = portal.getDefaultModule(portal_type='Credential Request')
...@@ -10,7 +12,11 @@ category_list = portal_preferences.getPreferredSubscriptionAssignmentCategoryLis ...@@ -10,7 +12,11 @@ category_list = portal_preferences.getPreferredSubscriptionAssignmentCategoryLis
if not context.CredentialRequest_checkLoginAvailability(reference): if not context.CredentialRequest_checkLoginAvailability(reference):
message_str = "Selected login is already in use, please choose different one." message_str = "Selected login is already in use, please choose different one."
if not batch_mode:
return portal.Base_redirect(keep_items = dict(portal_status_message=context.Base_translateString(message_str))) return portal.Base_redirect(keep_items = dict(portal_status_message=context.Base_translateString(message_str)))
else:
return json.dumps({'msg': message_str,
'code':1})
credential_request = module.newContent( credential_request = module.newContent(
portal_type="Credential Request", portal_type="Credential Request",
...@@ -68,6 +74,10 @@ else: ...@@ -68,6 +74,10 @@ else:
credential_request.submit("Automatic submit") credential_request.submit("Automatic submit")
message_str = "Credential Request Created." message_str = "Credential Request Created."
message_str = "Registration submitted. Wait for an email."
if not batch_mode: if not batch_mode:
return portal.Base_redirect(form_id='login_form', return portal.Base_redirect(form_id='login_form',
keep_items = dict(portal_status_message=context.Base_translateString(message_str))) keep_items = dict(portal_status_message=context.Base_translateString(message_str)))
else:
return json.dumps({'msg': message_str,
'code':0})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment