diff --git a/master/bt5/slapos_web/ExtensionTemplateItem/portal_components/extension.erp5.ViFiBWeb.py b/master/bt5/slapos_web/ExtensionTemplateItem/portal_components/extension.erp5.ViFiBWeb.py index 5464097d91a9b654df5882733ec507928890d614..ad98fb4f1279196e3c99cd626d3a05faf3fe95af 100644 --- a/master/bt5/slapos_web/ExtensionTemplateItem/portal_components/extension.erp5.ViFiBWeb.py +++ b/master/bt5/slapos_web/ExtensionTemplateItem/portal_components/extension.erp5.ViFiBWeb.py @@ -35,8 +35,7 @@ import apiclient.discovery import httplib2 import oauth2client.client import socket -from Products.ERP5Security.ERP5UserManager import getUserByLogin -from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod + # common methods def _getCacheFactory(self, cache_factory_name): @@ -180,50 +179,3 @@ def Google_checkUserExistence(self): # user exist if server gave some correct response without waiting for user return response.status in (200, 204) - -# Browser ID -def BrowserID_setServerToken(self, key, body): - setServerToken(self, key, body, 'browser_id_auth_token_cache_factory') - -def BrowserID_getServerToken(self, key): - return getServerToken(self, key, 'browser_id_auth_token_cache_factory') - - -def BrowserID_validateAssertion(self, assertion): - connection = httplib.HTTPSConnection(host='browserid.org', timeout=5) - data = urllib.urlencode({'assertion': assertion, - 'audience': self.REQUEST.get('SERVER_URL')}) - headers = {'Content-type': 'application/x-www-form-urlencoded'} - connection.request('POST', '/verify', data, headers) - response = connection.getresponse() - - if response.status != 200: - return None - - try: - body = json.loads(response.read()) - except Exception: - return None - - return body - -@UnrestrictedMethod -def BrowserID_checkUserExistence(self): - hash = self.REQUEST.get('__ac_browser_id_hash') - try: - user_dict = BrowserID_getServerToken(self, hash) - except KeyError: - return False - user = user_dict['login'] - tag = '%s_user_creation_in_progress' % user - person_list = getUserByLogin(self.getPortalObject(), user) - if len(person_list) == 0: - if self.getPortalObject().portal_activities.countMessageWithTag(tag) == 0: - user_entry = {'reference': user, - 'email': user[4:], - 'first_name': None, - 'last_name': None} - self.Base_createOauth2User(tag, **user_entry) - return False - else: - return True diff --git a/master/bt5/slapos_web/ExtensionTemplateItem/portal_components/extension.erp5.ViFiBWeb.xml b/master/bt5/slapos_web/ExtensionTemplateItem/portal_components/extension.erp5.ViFiBWeb.xml index 644442bfb5689dbabe4c54b27fc93b7f3c64cf18..2679b221a1959485e649fd90fbb3b6f026709f38 100644 --- a/master/bt5/slapos_web/ExtensionTemplateItem/portal_components/extension.erp5.ViFiBWeb.xml +++ b/master/bt5/slapos_web/ExtensionTemplateItem/portal_components/extension.erp5.ViFiBWeb.xml @@ -6,10 +6,22 @@ </pickle> <pickle> <dictionary> + <item> + <key> <string>_recorded_property_dict</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> <item> <key> <string>default_reference</string> </key> <value> <string>ViFiBWeb</string> </value> </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> <item> <key> <string>id</string> </key> <value> <string>extension.erp5.ViFiBWeb</string> </value> @@ -34,9 +46,8 @@ <key> <string>text_content_warning_message</string> </key> <value> <tuple> - <string>W:143, 2: Redefining built-in \'hash\' (redefined-builtin)</string> - <string>W:164, 2: Redefining built-in \'hash\' (redefined-builtin)</string> - <string>W:212, 2: Redefining built-in \'hash\' (redefined-builtin)</string> + <string>W:142, 2: Redefining built-in \'hash\' (redefined-builtin)</string> + <string>W:163, 2: Redefining built-in \'hash\' (redefined-builtin)</string> </tuple> </value> </item> @@ -47,13 +58,28 @@ <item> <key> <string>workflow_history</string> </key> <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> </value> </item> </dictionary> </pickle> </record> <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> <pickle> <global name="PersistentMapping" module="Persistence.mapping"/> </pickle> @@ -66,7 +92,7 @@ <item> <key> <string>component_validation_workflow</string> </key> <value> - <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> </value> </item> </dictionary> @@ -75,7 +101,7 @@ </dictionary> </pickle> </record> - <record id="3" aka="AAAAAAAAAAM="> + <record id="4" aka="AAAAAAAAAAQ="> <pickle> <global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/> </pickle> diff --git a/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_checkUserExistence.xml b/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_checkUserExistence.xml deleted file mode 100644 index 89e1d06b357d1560573cd09ab341aef3962c1245..0000000000000000000000000000000000000000 --- a/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_checkUserExistence.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_function</string> </key> - <value> <string>BrowserID_checkUserExistence</string> </value> - </item> - <item> - <key> <string>_module</string> </key> - <value> <string>ViFiBWeb</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>BrowserID_checkUserExistence</string> </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string></string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_setServerToken.xml b/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_setServerToken.xml deleted file mode 100644 index e6aa02c5637e1c6d0e97bd8c8b31de0c8263ed35..0000000000000000000000000000000000000000 --- a/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_setServerToken.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_function</string> </key> - <value> <string>BrowserID_setServerToken</string> </value> - </item> - <item> - <key> <string>_module</string> </key> - <value> <string>ViFiBWeb</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>BrowserID_setServerToken</string> </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string></string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_validateAssertion.xml b/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_validateAssertion.xml deleted file mode 100644 index 1593e982343db9aa2da7b2fe490d2fb16769d093..0000000000000000000000000000000000000000 --- a/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_validateAssertion.xml +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_function</string> </key> - <value> <string>BrowserID_validateAssertion</string> </value> - </item> - <item> - <key> <string>_module</string> </key> - <value> <string>ViFiBWeb</string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>BrowserID_validateAssertion</string> </value> - </item> - <item> - <key> <string>title</string> </key> - <value> <string></string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewBrowserIdLogin.xml b/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewBrowserIdLogin.xml deleted file mode 100644 index 410897572e47932a82034e29ae8a2ce2b265546b..0000000000000000000000000000000000000000 --- a/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewBrowserIdLogin.xml +++ /dev/null @@ -1,58 +0,0 @@ -<?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>WebSection_viewBrowserIdLogin</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> diff --git a/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewBrowserIdLogin.zpt b/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewBrowserIdLogin.zpt deleted file mode 100644 index 66e7032d0f4deeae5dc1ff44950726d014d23af4..0000000000000000000000000000000000000000 --- a/master/bt5/slapos_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewBrowserIdLogin.zpt +++ /dev/null @@ -1,47 +0,0 @@ -<html> - - <tal:block tal:define="website_url python: here.getWebSiteValue().absolute_url(); - dummy python: request.RESPONSE.setCookie('redirect_after_login', context.REQUEST.form.get('callback_url', website_url), path='/');"> - </tal:block> - <script src="https://code.jquery.com/jquery-1.9.1.js"></script> - <script src="https://browserid.org/include.js" type="text/javascript"></script> - <script type="text/javascript"> - $(document).ready(function() {navigator.id.get(gotAssertion); - return false;}); - -function post_to_url(path, params, method) { - method = method || "post"; // Set method to post by default, if not specified. - - // The rest of this code assumes you are not using a library. - // It can be made less wordy if you use one. - var form = document.createElement("form"); - form.setAttribute("method", method); - form.setAttribute("action", path); - - for(var key in params) { - if(params.hasOwnProperty(key)) { - var hiddenField = document.createElement("input"); - hiddenField.setAttribute("type", "hidden"); - hiddenField.setAttribute("name", key); - hiddenField.setAttribute("value", params[key]); - - form.appendChild(hiddenField); - } - } - - document.body.appendChild(form); - form.submit(); -} - -function gotAssertion(assertion) { - // got an assertion, now send it up to the server for verification - if (assertion !== null) { - post_to_url("https://www.slapos.org/login_with_browser_id/", {'assertion': assertion}) - } -} -</script> - -<body> - Waiting login .... -</body> -</html> \ No newline at end of file