Commit 65fcbb7e authored by Gabriel Monnerat's avatar Gabriel Monnerat Committed by Jérome Perrin

login_form: Use ERP5Site_getAvailableOAuthLoginList to know if google login is...

login_form: Use ERP5Site_getAvailableOAuthLoginList to know if google login is supported or not. With this, we can extend to other oauth easily
parent ac33a6a2
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
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;
enable_google_login python: getattr(context.getPortalObject().portal_skins, 'erp5_oauth_google_login', None) is not None; available_oauth_login_list python: context.getPortalObject().ERP5Site_getAvailableOAuthLoginList();
enable_google_login python: 'google' in available_oauth_login_list;
css_list python: enable_google_login and ['%s/zocial.min.css' % here.portal_url()] or []; css_list python: enable_google_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">
......
oauth_login_list = []
portal_skin = context.getPortalObject().portal_skins
if getattr(portal_skin, "erp5_oauth_google_login", None) is not None:
oauth_login_list.append("google")
return oauth_login_list
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<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_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<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>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getAvailableOAuthLoginList</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -3,7 +3,8 @@ ...@@ -3,7 +3,8 @@
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;
enable_google_login python: getattr(context.getPortalObject().portal_skins, 'erp5_oauth_google_login', None) is not None; available_oauth_login_list python: context.getPortalObject().ERP5Site_getAvailableOAuthLoginList();
enable_google_login python: 'google' in available_oauth_login_list;
css_list python: enable_google_login and ['%s/zocial.min.css' % here.portal_url()] or []; css_list python: enable_google_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">
......
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