Commit 18e6ee3c authored by Roque's avatar Roque

erp5_credential: update login and join

- account creation new credential preference
- new standard join form
parent 18701c5a
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Standard Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/boolean</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>If set it will enable the "create new account" section in the login form</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>preferred_enable_account_creation_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Standard Property</string> </value>
</item>
<item>
<key> <string>preference</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>property_default</string> </key>
<value> <string>python: False</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -12,4 +12,4 @@ else: ...@@ -12,4 +12,4 @@ else:
mail_message.deliver() mail_message.deliver()
message = translateString("Your account is being activated. You will receive an e-mail when activation is complete.") message = translateString("Your account is being activated. You will receive an e-mail when activation is complete.")
return portal.Base_redirect("login_form", keep_items=dict(portal_status_message=message)) return context.Base_redirect("login_form", keep_items=dict(portal_status_message=message))
...@@ -8,9 +8,14 @@ module = portal.getDefaultModule(portal_type='Credential Request') ...@@ -8,9 +8,14 @@ module = portal.getDefaultModule(portal_type='Credential Request')
portal_preferences = portal.portal_preferences portal_preferences = portal.portal_preferences
category_list = portal_preferences.getPreferredSubscriptionAssignmentCategoryList() category_list = portal_preferences.getPreferredSubscriptionAssignmentCategoryList()
if password_confirmation:
if password != password_confirmation:
message_str = "Password and Confirmation Password must be same"
return context.Base_redirect("join_form", keep_items=dict(portal_status_message=message_str), notification_status='error')
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."
return portal.Base_redirect(keep_items = dict(portal_status_message=context.Base_translateString(message_str))) return context.Base_redirect("join_form", keep_items=dict(portal_status_message=message_str))
credential_request = module.newContent( credential_request = module.newContent(
portal_type="Credential Request", portal_type="Credential Request",
...@@ -68,6 +73,4 @@ else: ...@@ -68,6 +73,4 @@ else:
credential_request.submit("Automatic submit") credential_request.submit("Automatic submit")
message_str = "Credential Request Created." message_str = "Credential Request Created."
return context.Base_redirect("login_form", keep_items=dict(portal_status_message=message_str))
return portal.Base_redirect(form_id='login_form',
keep_items = dict(portal_status_message=context.Base_translateString(message_str)))
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>reference, default_email_text, first_name=None, last_name=None, password=None, date_of_birth=None, default_telephone_text=None, default_mobile_telephone_text=None, default_fax_text=None, corporate_name=None, default_credential_question_question=None, default_credential_question_question_free_text=None, default_credential_question_answer=None, role_list=None, function=None, site=None, activity_list=None, default_address_city=None, default_address_street_address=None, default_address_zip_code=None,default_address_region=None, dialog_id=\'\', **kw</string> </value> <value> <string>reference, default_email_text, first_name=None, last_name=None, password=None, password_confirmation=None, date_of_birth=None, default_telephone_text=None, default_mobile_telephone_text=None, default_fax_text=None, corporate_name=None, default_credential_question_question=None, default_credential_question_question_free_text=None, default_credential_question_answer=None, role_list=None, function=None, site=None, activity_list=None, default_address_city=None, default_address_street_address=None, default_address_zip_code=None,default_address_region=None, dialog_id=\'\', **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
<string>my_preferred_ask_login_on_password_recovery</string> <string>my_preferred_ask_login_on_password_recovery</string>
<string>my_preferred_person_credential_update_automatic_approval</string> <string>my_preferred_person_credential_update_automatic_approval</string>
<string>my_preferred_credential_alarm_automatic_call</string> <string>my_preferred_credential_alarm_automatic_call</string>
<string>my_preferred_enable_account_creation</string>
</list> </list>
</value> </value>
</item> </item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_preferred_enable_account_creation</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_checkbox</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Enable Account Creation</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ZopePageTemplate" module="Products.PageTemplates.ZopePageTemplate"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/html</string> </value>
</item>
<item>
<key> <string>expand</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>join_form</string> </value>
</item>
<item>
<key> <string>output_encoding</string> </key>
<value> <string>utf-8</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <unicode></unicode> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title tal:content="python: here.getPortalObject().getTitle()"></title>
<link rel="stylesheet" href="gadget_erp5_nojqm.css">
</head>
<body tal:define="form_action string:ERP5Site_newCredentialRequest;">
<div data-role='page'>
<div data-gadget-scope='header'>
<div class="ui-header">
<h1><span i18n:domain="ui" i18n:translate="">Join</span></h1>
</div>
</div>
<div data-gadget-scope='panel'>
<div data-role="header">
<div class="panel_img">
<img alt="Join" src="join_form_logo.png"/>
</div>
</div>
</div>
<div class="ui-content gadget-content">
<article>
<section>
<tal:block tal:condition="exists: request/portal_status_message">
<span tal:attributes="data-i18n request/portal_status_message"><span tal:content="request/portal_status_message"></span></span>
</tal:block>
</section>
<section>
<form method="post" tal:attributes="action python: '%s/' % context.absolute_url()">
<div class="field_container">
<div class="left" style="width:49% !important">
<div class="ui-field-contain">
<label i18n:domain="ui" i18n:translate="" >First Name</label>
<div><input autofocus type="text" name="first_name" value="" required=""></div>
</div><br/>
<div class="ui-field-contain">
<label i18n:domain="ui" i18n:translate="" >Last Name</label>
<div><input autofocus type="text" name="last_name" value="" required=""></div>
</div><br/>
<div class="ui-field-contain">
<label i18n:domain="ui" i18n:translate="" >Email</label>
<div><input autofocus type="email" name="default_email_text" value="" required=""></div>
</div><br/>
<div class="ui-field-contain">
<label i18n:domain="ui" i18n:translate="" >User Login</label>
<div><input autofocus type="text" name="reference" value="" required=""></div>
</div><br/>
<div class="ui-field-contain">
<label i18n:domain="ui" i18n:translate="" >Password</label>
<div><input autofocus type="password" name="password" value="" required=""></div>
</div><br/>
<div class="ui-field-contain">
<label i18n:domain="ui" i18n:translate="" >Password Confirmation</label>
<div><input type="password" name="password_confirmation" value="" required=""></div>
</div><br/>
<div class="ui-field-contain">
<label i18n:domain="ui" i18n:translate="" ></label>
</div><br/>
</div>
<div class="bottom">
<div class="ui-field-contain">
<label></label>
<div><strong> You will receive a confirmation email to activate your account. </strong></div>
</div>
<div class="ui-field-contain">
<label></label>
<div><input type="submit" value='Register' i18n:attributes="value" i18n:domain="ui" tal:attributes="name python: '%s:method' % (form_action, )"/></div>
</div><br/>
<input type="hidden" name="url" tal:attributes="value python: context.absolute_url()" />
<input tal:condition="exists: request/came_from"
type="hidden" name="came_from"
tal:attributes="value request/came_from" />
</div>
</div>
</form>
</section>
</article>
</div>
</div>
</body>
</html>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Image" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>join_form_logo.png</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>image/png</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>53</int> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>127</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -3,10 +3,12 @@ ...@@ -3,10 +3,12 @@
xmlns:i18n="http://xml.zope.org/namespaces/i18n"> xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<tal:block tal:define="form_action string:logged_in; <tal:block tal:define="form_action string:logged_in;
global form_id string:login_form; global form_id string:login_form;
available_oauth_login_list python: context.getPortalObject().ERP5Site_getAvailableOAuthLoginList(); portal context/getPortalObject;
available_oauth_login_list python: portal.ERP5Site_getAvailableOAuthLoginList();
enable_google_login python: 'google' in available_oauth_login_list; enable_google_login python: 'google' in available_oauth_login_list;
enable_facebook_login python: 'facebook' in available_oauth_login_list; enable_facebook_login python: 'facebook' in available_oauth_login_list;
enable_openidconnect_login python: 'openidconnect' in available_oauth_login_list; enable_openidconnect_login python: 'openidconnect' in available_oauth_login_list;
enable_account_creation python: portal.portal_preferences.getPreferredEnableAccountCreation();
css_list python: (enable_google_login or enable_facebook_login) and ['%s/zocial.min.css' % here.portal_url()] or []; css_list python: (enable_google_login or enable_facebook_login) and ['%s/zocial.min.css' % here.portal_url()] or [];
js_list python: ['%s/login_form.js' % (here.portal_url(), ), '%s/erp5.js' % (here.portal_url(), )]"> js_list python: ['%s/login_form.js' % (here.portal_url(), ), '%s/erp5.js' % (here.portal_url(), )]">
<tal:block metal:use-macro="here/main_template/macros/master"> <tal:block metal:use-macro="here/main_template/macros/master">
...@@ -80,6 +82,16 @@ ...@@ -80,6 +82,16 @@
i18n:translate="" i18n:domain="ui" class="zocial openid">Login with OpenId Connect</a> i18n:translate="" i18n:domain="ui" class="zocial openid">Login with OpenId Connect</a>
</div> </div>
</div> </div>
</tal:block>
<br>
<tal:block tal:condition="enable_account_creation">
<div class="ui-field-contain">
<label></label>
<div>
<a tal:attributes="href string:join_form" i18n:translate=""
i18n:domain="ui" class="zocial secondary"> Create New Account </a>
</div>
</div>
</tal:block> </tal:block>
</fieldset> </fieldset>
<script type="text/javascript">setFocus()</script> <script type="text/javascript">setFocus()</script>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Image" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>__name__</string> </key>
<value> <string>login_form_logo.png</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>image/png</string> </value>
</item>
<item>
<key> <string>height</string> </key>
<value> <int>53</int> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>width</string> </key>
<value> <int>127</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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