From 6cb331f8ab27649721976eae56b5bc44f372ca3e Mon Sep 17 00:00:00 2001
From: Gabriel Monnerat <gabriel@tiolive.com>
Date: Fri, 30 Sep 2016 00:00:58 +0000
Subject: [PATCH] erp5_credential: Add link to login in ERP5 with Google
 Account and use zocial.min.css to display it nicely

---
 .../portal_skins/erp5_credential/login_form.zpt      | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/login_form.zpt b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/login_form.zpt
index 7520d158e5..086f48cff1 100644
--- a/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/login_form.zpt
+++ b/bt5/erp5_credential/SkinTemplateItem/portal_skins/erp5_credential/login_form.zpt
@@ -3,6 +3,8 @@
            xmlns:i18n="http://xml.zope.org/namespaces/i18n">
   <tal:block tal:define="form_action string:logged_in;
              global form_id string:login_form;
+             enable_google_login python: getattr(context.getPortalObject().portal_skins, 'erp5_oauth_google_login', None) is not None;
+             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(), )]">
     <tal:block metal:use-macro="here/main_template/macros/master">
       <tal:block metal:fill-slot="main">
@@ -45,7 +47,17 @@
                 <a tal:attributes="href string:${here/portal_url}/ERP5Site_viewCredentialRecoveryLoginDialog"
                    i18n:translate="" i18n:domain="ui">Can't access your account ?</a>
               </div>
+              <p class="clear"></p>
             </div>
+            <tal:block tal:condition="enable_google_login">
+              <div class="field">
+                <label>&nbsp;</label>
+                <div class="input">
+                  <a tal:attributes="href string:${here/portal_url}/ERP5Site_redirectToGoogleLoginPage"
+                     i18n:translate="" i18n:domain="ui" class="zocial google">Login with Google</a>
+                </div>
+              </div>
+            </tal:block>
           </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>
-- 
2.30.9