Commit 7ab55371 authored by Rafael Monnerat's avatar Rafael Monnerat Committed by Alain Takoudjou

slapos_web: Implement enable/disable social login

This change allow the admnistrator pick the default login page for the site, if this supports google/facebook login or not.
parent 98e2b92c
......@@ -103,6 +103,7 @@
<string>my_layout_subscription_contract_reference</string>
<string>my_layout_terms_of_service_reference</string>
<string>my_layout_required_role</string>
<string>my_layout_enable_social_login</string>
</list>
</value>
</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_layout_enable_social_login</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>
</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>
</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>title</string> </key>
<value> <string>Enable Social Login</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<tal:block tal:define="form_action string:logged_in;
global form_id string:login_form;
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:fill-slot="main">
<div class="content login">
<tal:block tal:condition="python: request.get('came_from', None) is None">
<h1 i18n:translate="" i18n:domain="ui">Log in</h1>
</tal:block>
<tal:block tal:condition="python: request.get('came_from', None) is not None">
<h1 i18n:translate="" i18n:domain="ui">You do not have enough permissions to access this page.</h1>
<p i18n:translate="" i18n:domain="ui">You can login with another user name or
<span i18n:name="go_back"><a href="javascript:history.back();" i18n:translate="">go back</a></span>.
</p>
</tal:block>
<input tal:condition="exists: request/came_from"
type="hidden" name="came_from"
tal:attributes="value request/came_from" />
<fieldset>
<div class="field login_name">
<label for="name" class="required" i18n:translate="" i18n:domain="ui">Name</label>
<div class="input"><input type="text" name="__ac_name" id="name" tal:attributes="value python: request.get('__ac_name') or ''" /></div>
<p class="clear"></p>
</div>
<div class="field login_password">
<label for="password" i18n:translate="" i18n:domain="ui">Password</label>
<div class="input"><input type="password" name="__ac_password" id="password" /></div>
<p class="clear"></p>
</div>
<div class="field login_remember">
<label for="cb_remember" i18n:translate="" i18n:domain="ui">Remember my name</label>
<div class="input"><input type="checkbox" name="__ac_persistent" value="1" checked="checked" id="cb_remember" /></div>
<p class="clear"></p>
</div>
<div class="field login_button">
<label>&nbsp;</label>
<div class="input">
<input type="submit" value="Login" class="submit"
tal:attributes="name python: '%s:method' % (form_action, )"
i18n:attributes="value" i18n:domain="ui" />
</div>
<p class="clear"></p>
</div>
<div class="field forgotten_password">
<label>&nbsp;</label>
<div class="field nolabel validate widthAuto" title="">
<label>Join</label>
<a href="./join">Join</a>
</div>
<div class="field nolabel cancel widthAuto" title="">
<label>Lost password?</label>
<a href="./reset-password">Lost password?</a>
</div>
</div>
</fieldset>
<script type="text/javascript">setFocus()</script>
<p i18n:translate="" i18n:domain="ui">Having trouble logging in? Make sure to enable cookies in your web browser.</p>
<p i18n:translate="" i18n:domain="ui">Do not forget to logout or exit your browser when you are done.</p>
<p i18n:translate="" i18n:domain="ui">Setting the 'Remember my name' option will set a cookie with your username, so that when you login next time, your user name will already be filled in for you.</p>
</div>
</tal:block>
</tal:block>
</tal:block>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<tal:block tal:define="form_action string:logged_in;
global form_id string:login_form;
web_site python: here.getWebSiteValue();
enable_social_login python: web_site.getLayoutProperty('layout_enable_social_login')">
<tal:block tal:condition="enable_social_login">
<tal:block tal:content="structure here/slapos_login_form" />
</tal:block>
<tal:block tal:condition="python: not enable_social_login">
<tal:block tal:content="structure here/traditional_login_form" />
</tal:block>
</tal:block>
</tal:block>
\ No newline at end of file
<?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>_local_properties</string> </key>
<value>
<tuple/>
</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>slapos_login_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>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<tal:block tal:define="form_action string:logged_in;
global form_id string:login_form;
is_annonymous python: here.portal_membership.isAnonymousUser();
web_site python: here.getWebSiteValue();
login_message_reference python: web_site.getLayoutProperty('layout_login_message_reference', 'slapos-login.message');
login_message_document_list python: web_site.getDocumentValueList(reference='slapos-login.message');
preparing_google python: here.REQUEST.get('__ac_google_hash') is not None and not here.Google_checkUserExistence();
preparing_facebook python: here.REQUEST.get('__ac_facebook_hash') is not None and not here.Facebook_checkUserExistence();
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:fill-slot="main">
<tal:block tal:condition="python: preparing_google or preparing_facebook">
<div class="preparing">
<script type="text/JavaScript">
<!--
function timedRefresh(timeoutPeriod) {
setTimeout("location.reload(true);",timeoutPeriod);
}
timedRefresh(3000);
// -->
</script>
<p><img src="ERP5VCS_imgs/wait.gif"></p>
We are preparing your user.
</div>
</tal:block>
<div class="content login">
<tal:block tal:condition="python: request.get('came_from', None) is None">
<h1 i18n:translate="" i18n:domain="ui">Log in</h1>
</tal:block>
<tal:block tal:condition="python: request.get('came_from', None) is not None">
<h1 i18n:translate="" i18n:domain="ui">Please login before continue.</h1>
</tal:block>
<tal:block tal:condition="python: request.get('came_from', None) is not None">
<tal:block tal:define="dummy python: request.RESPONSE.setCookie('redirect_after_login', request.get('came_from'), path='/')"></tal:block>
</tal:block>
<fieldset>
<tal:block tal:condition="python: is_annonymous">
<div class="field nolabel validate widthAuto forgotten_password center"><br/><br/>
If you have Google or Facebook accounts feel free to use any of them to signup<br/><br/>
<a class="zocial facebook" href="./login_with_facebook">Signup with Facebook</a> or
<a class="zocial google" href="./login_with_google">Signup with Google</a><br/><br/>
You are not connected with social network? So then use BrowserID <a href="login_with_browser_id" id="browserid" title="Sign-in with BrowserID"> <img src="./vifib_image/browser_id_logo.png" alt="Sign-in with BrowserID" title="Sign-in with BrowserID"></a>
</div>
<tal:block tal:condition="python: login_message_document_list">
<div tal:content="structure python: login_message_document_list[0].convert(format='html')[1]" class="field nolabel widthAuto center" style="background: white; color: #FF0066;; margin-top: 2em; text-align: left">
</div>
</tal:block>
</tal:block>
<tal:block tal:condition="python: not is_annonymous">
<div class="field nolabel validate widthAuto forgotten_password center"><br/><br/>
You are logged in, continue <a href="../WebSection_redirectAfterLogin">accessing our site... </a>.
</div>
</tal:block>
</tal:block>
</tal:block>
</tal:block>
</tal:block>
\ No newline at end of file
<?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>_local_properties</string> </key>
<value>
<tuple/>
</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>traditional_login_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>
<tal:block xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n">
<tal:block tal:define="form_action string:logged_in;
global form_id string:login_form;
web_site python: here.getWebSiteValue();
login_message_reference python: web_site.getLayoutProperty('layout_login_message_reference', 'slapos-login.message');
login_message_document_list python: web_site.getDocumentValueList(reference='slapos-login.message');
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:fill-slot="main">
<div class="content login">
<tal:block tal:condition="python: request.get('came_from', None) is None">
<h1 i18n:translate="" i18n:domain="ui">Log in</h1>
</tal:block>
<tal:block tal:condition="python: request.get('came_from', None) is not None">
<h1 i18n:translate="" i18n:domain="ui">You do not have enough permissions to access this page.</h1>
<p i18n:translate="" i18n:domain="ui">You can login with another user name or
<span i18n:name="go_back"><a href="javascript:history.back();" i18n:translate="">go back</a></span>.
</p>
</tal:block>
<input tal:condition="exists: request/came_from"
type="hidden" name="came_from"
tal:attributes="value request/came_from" />
<fieldset>
<div class="field login_name">
<label for="name" class="required" i18n:translate="" i18n:domain="ui">Name</label>
<div class="input"><input type="text" name="__ac_name" id="name" tal:attributes="value python: request.get('__ac_name') or ''" /></div>
<p class="clear"></p>
</div>
<div class="field login_password">
<label for="password" i18n:translate="" i18n:domain="ui">Password</label>
<div class="input"><input type="password" name="__ac_password" id="password" /></div>
<p class="clear"></p>
</div>
<div class="field login_remember">
<label for="cb_remember" i18n:translate="" i18n:domain="ui">Remember my name</label>
<div class="input"><input type="checkbox" name="__ac_persistent" value="1" checked="checked" id="cb_remember" /></div>
<p class="clear"></p>
</div>
<div class="field login_button">
<label>&nbsp;</label>
<div class="input">
<input type="submit" value="Login" class="submit"
tal:attributes="name python: '%s:method' % (form_action, )"
i18n:attributes="value" i18n:domain="ui" />
</div>
<p class="clear"></p>
</div>
<div class="field forgotten_password">
<label>&nbsp;</label>
<div class="field nolabel validate widthAuto" title="">
<label>Join</label>
<a href="ERP5Site_viewCredentialRequestForm">Join</a>
</div>
<div class="field nolabel cancel widthAuto" title="">
<label>Lost password?</label>
<a href="ERP5Site_viewCredentialRecoveryLoginDialog">Lost password?</a>
</div>
</div>
</fieldset>
<script type="text/javascript">setFocus()</script>
<p i18n:translate="" i18n:domain="ui">Having trouble logging in? Make sure to enable cookies in your web browser.</p>
<p i18n:translate="" i18n:domain="ui">Do not forget to logout or exit your browser when you are done.</p>
<p i18n:translate="" i18n:domain="ui">Setting the 'Remember my name' option will set a cookie with your username, so that when you login next time, your user name will already be filled in for you.</p>
</div>
<tal:block tal:condition="python: login_message_document_list">
<div tal:content="structure python: login_message_document_list[0].convert(format='html')[1]" class="field nolabel widthAuto center" style="background: white; color: #FF0066;; margin-top: 2em; text-align: left">
</div>
</tal:block>
</tal:block>
</tal:block>
</tal:block>
</tal:block>
\ No newline at end of file
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