-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Branch: refs/heads/master Date: 2016-04-30T23:01:26+02:00 Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> Commit: plone/plone.app.users@caa6a2f Fixed KeyError email on personal preferences form. (#58) This could happen when email is used as login name. Fixes plone/plone.app.users#56 and plone/Products.CMFPlone#1146 Files changed: M CHANGES.rst M plone/app/users/browser/account.py
- Loading branch information
Showing
1 changed file
with
39 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,266 +1,55 @@ | ||
Repository: Products.CMFPlone | ||
Repository: plone.app.users | ||
|
||
|
||
Branch: refs/heads/5.0.x | ||
Date: 2016-04-29T17:32:54+02:00 | ||
Author: Eric BREHAULT (ebrehault) <ebrehault@gmail.com> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/3d71767c17baeec408624b85f3600214095c6727 | ||
Branch: refs/heads/master | ||
Date: 2016-04-30T23:01:26+02:00 | ||
Author: Maurits van Rees (mauritsvanrees) <maurits@vanrees.org> | ||
Commit: https://github.com/plone/plone.app.users/commit/caa6a2f9c33ed3fa01d8e24955aa18701844207a | ||
|
||
compute requirejs config baseUrl on client-side | ||
Fixed KeyError email on personal preferences form. (#58) | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M Products/CMFPlone/controlpanel/browser/resourceregistry.py | ||
M Products/CMFPlone/resources/browser/configjs.py | ||
M Products/CMFPlone/resources/browser/scripts.pt | ||
M Products/CMFPlone/resources/browser/scripts.py | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index 93b5ae2..0ae1618 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -36,6 +36,9 @@ Fixes: | ||
- Fix bundle aggregation when bundle has no CSS (or no JS) | ||
[ebrehault] | ||
|
||
+- Do not hard-code baseUrl in bundle to avoid bad URL when switching domains. | ||
+ [ebrehault] | ||
+ | ||
|
||
5.0.4 (2016-04-06) | ||
------------------ | ||
diff --git a/Products/CMFPlone/controlpanel/browser/resourceregistry.py b/Products/CMFPlone/controlpanel/browser/resourceregistry.py | ||
index d4de75c..9fda35a 100644 | ||
--- a/Products/CMFPlone/controlpanel/browser/resourceregistry.py | ||
+++ b/Products/CMFPlone/controlpanel/browser/resourceregistry.py | ||
@@ -287,7 +287,7 @@ def less_build_config(self): | ||
}) | ||
|
||
def js_build_config(self): | ||
- (baseUrl, paths, shims) = self.get_requirejs_config() | ||
+ (paths, shims) = self.get_requirejs_config() | ||
bundles = self.get_bundles() | ||
resources = self.get_resources() | ||
|
||
diff --git a/Products/CMFPlone/resources/browser/configjs.py b/Products/CMFPlone/resources/browser/configjs.py | ||
index 7ee3db7..4fa690c 100644 | ||
--- a/Products/CMFPlone/resources/browser/configjs.py | ||
+++ b/Products/CMFPlone/resources/browser/configjs.py | ||
@@ -4,12 +4,11 @@ | ||
from Products.CMFPlone.interfaces import IResourceRegistry | ||
from Products.Five.browser import BrowserView | ||
from plone.registry.interfaces import IRegistry | ||
-from zope.component import getMultiAdapter | ||
from zope.component import getUtility | ||
|
||
|
||
configjs = """requirejs.config({ | ||
- baseUrl: '%s', | ||
+ baseUrl: PORTAL_URL, | ||
paths: %s, | ||
shim: %s, | ||
optimize: 'uglify', | ||
@@ -52,12 +51,6 @@ def registryResources(self): | ||
return self.registry.collectionOfInterface( | ||
IResourceRegistry, prefix="plone.resources", check=False) | ||
|
||
- def base_url(self): | ||
- portal_state = getMultiAdapter((self.context, self.request), | ||
- name=u'plone_portal_state') | ||
- site_url = portal_state.portal_url() | ||
- return site_url | ||
- | ||
def get_requirejs_config(self): | ||
""" | ||
Returns the information for requirejs configuration | ||
@@ -85,18 +78,17 @@ def get_requirejs_config(self): | ||
# Resources available under name-url name | ||
src = script.url | ||
paths[name + '-url'] = src | ||
- return (self.base_url(), paths, shims) | ||
+ return (paths, shims) | ||
|
||
|
||
class ConfigJsView(RequireJsView): | ||
""" config.js for requirejs for script rendering. """ | ||
|
||
def __call__(self): | ||
- (baseUrl, paths, shims) = self.get_requirejs_config() | ||
+ (paths, shims) = self.get_requirejs_config() | ||
self.request.response.setHeader("Content-Type", | ||
"application/javascript") | ||
return configjs % ( | ||
- baseUrl, | ||
json.dumps(paths, indent=4), | ||
_format_shims(shims) | ||
) | ||
diff --git a/Products/CMFPlone/resources/browser/scripts.pt b/Products/CMFPlone/resources/browser/scripts.pt | ||
index e1c3bf7..73b8639 100644 | ||
--- a/Products/CMFPlone/resources/browser/scripts.pt | ||
+++ b/Products/CMFPlone/resources/browser/scripts.pt | ||
@@ -1,3 +1,4 @@ | ||
+<script type="text/javascript" tal:content="string:PORTAL_URL = '${view/base_url}';"></script> | ||
<tal:scripts repeat="script view/scripts" | ||
><tal:block define="condcomment script/conditionalcomment" | ||
><tal:wcondcomment tal:condition="condcomment"> | ||
diff --git a/Products/CMFPlone/resources/browser/scripts.py b/Products/CMFPlone/resources/browser/scripts.py | ||
index 0a8d60a..52ab2cb 100644 | ||
--- a/Products/CMFPlone/resources/browser/scripts.py | ||
+++ b/Products/CMFPlone/resources/browser/scripts.py | ||
@@ -3,6 +3,7 @@ | ||
|
||
from Products.CMFPlone.resources.browser.cook import cookWhenChangingSettings | ||
from Products.CMFPlone.resources.browser.resource import ResourceView | ||
+from zope.component import getMultiAdapter | ||
|
||
|
||
class ScriptsView(ResourceView): | ||
@@ -107,6 +108,12 @@ def default_resources(self): | ||
}) | ||
return result | ||
|
||
+ def base_url(self): | ||
+ portal_state = getMultiAdapter((self.context, self.request), | ||
+ name=u'plone_portal_state') | ||
+ site_url = portal_state.portal_url() | ||
+ return site_url | ||
+ | ||
def scripts(self): | ||
"""The requirejs scripts, the ones that are not resources are loaded on | ||
configjs.py | ||
|
||
|
||
Repository: Products.CMFPlone | ||
|
||
|
||
Branch: refs/heads/5.0.x | ||
Date: 2016-04-30T17:12:51+02:00 | ||
Author: Eric BREHAULT (ebrehault) <ebrehault@gmail.com> | ||
Commit: https://github.com/plone/Products.CMFPlone/commit/8116dfa9e5578ef2ca3dd9385a1cfa36ca8aa037 | ||
|
||
Merge pull request #1563 from plone/fix-1530-50x | ||
|
||
compute requirejs config baseUrl on client-side | ||
This could happen when email is used as login name. | ||
|
||
Fixes https://github.com/plone/plone.app.users/issues/56 | ||
and https://github.com/plone/Products.CMFPlone/issues/1146 | ||
|
||
Files changed: | ||
M CHANGES.rst | ||
M Products/CMFPlone/controlpanel/browser/resourceregistry.py | ||
M Products/CMFPlone/resources/browser/configjs.py | ||
M Products/CMFPlone/resources/browser/scripts.pt | ||
M Products/CMFPlone/resources/browser/scripts.py | ||
M plone/app/users/browser/account.py | ||
|
||
diff --git a/CHANGES.rst b/CHANGES.rst | ||
index 93b5ae2..0ae1618 100644 | ||
index 5654679..5a81de2 100644 | ||
--- a/CHANGES.rst | ||
+++ b/CHANGES.rst | ||
@@ -36,6 +36,9 @@ Fixes: | ||
- Fix bundle aggregation when bundle has no CSS (or no JS) | ||
[ebrehault] | ||
|
||
+- Do not hard-code baseUrl in bundle to avoid bad URL when switching domains. | ||
+ [ebrehault] | ||
+ | ||
|
||
5.0.4 (2016-04-06) | ||
------------------ | ||
diff --git a/Products/CMFPlone/controlpanel/browser/resourceregistry.py b/Products/CMFPlone/controlpanel/browser/resourceregistry.py | ||
index d4de75c..9fda35a 100644 | ||
--- a/Products/CMFPlone/controlpanel/browser/resourceregistry.py | ||
+++ b/Products/CMFPlone/controlpanel/browser/resourceregistry.py | ||
@@ -287,7 +287,7 @@ def less_build_config(self): | ||
}) | ||
|
||
def js_build_config(self): | ||
- (baseUrl, paths, shims) = self.get_requirejs_config() | ||
+ (paths, shims) = self.get_requirejs_config() | ||
bundles = self.get_bundles() | ||
resources = self.get_resources() | ||
|
||
diff --git a/Products/CMFPlone/resources/browser/configjs.py b/Products/CMFPlone/resources/browser/configjs.py | ||
index 7ee3db7..4fa690c 100644 | ||
--- a/Products/CMFPlone/resources/browser/configjs.py | ||
+++ b/Products/CMFPlone/resources/browser/configjs.py | ||
@@ -4,12 +4,11 @@ | ||
from Products.CMFPlone.interfaces import IResourceRegistry | ||
from Products.Five.browser import BrowserView | ||
from plone.registry.interfaces import IRegistry | ||
-from zope.component import getMultiAdapter | ||
from zope.component import getUtility | ||
|
||
|
||
configjs = """requirejs.config({ | ||
- baseUrl: '%s', | ||
+ baseUrl: PORTAL_URL, | ||
paths: %s, | ||
shim: %s, | ||
optimize: 'uglify', | ||
@@ -52,12 +51,6 @@ def registryResources(self): | ||
return self.registry.collectionOfInterface( | ||
IResourceRegistry, prefix="plone.resources", check=False) | ||
|
||
- def base_url(self): | ||
- portal_state = getMultiAdapter((self.context, self.request), | ||
- name=u'plone_portal_state') | ||
- site_url = portal_state.portal_url() | ||
- return site_url | ||
- | ||
def get_requirejs_config(self): | ||
""" | ||
Returns the information for requirejs configuration | ||
@@ -85,18 +78,17 @@ def get_requirejs_config(self): | ||
# Resources available under name-url name | ||
src = script.url | ||
paths[name + '-url'] = src | ||
- return (self.base_url(), paths, shims) | ||
+ return (paths, shims) | ||
|
||
|
||
class ConfigJsView(RequireJsView): | ||
""" config.js for requirejs for script rendering. """ | ||
|
||
def __call__(self): | ||
- (baseUrl, paths, shims) = self.get_requirejs_config() | ||
+ (paths, shims) = self.get_requirejs_config() | ||
self.request.response.setHeader("Content-Type", | ||
"application/javascript") | ||
return configjs % ( | ||
- baseUrl, | ||
json.dumps(paths, indent=4), | ||
_format_shims(shims) | ||
) | ||
diff --git a/Products/CMFPlone/resources/browser/scripts.pt b/Products/CMFPlone/resources/browser/scripts.pt | ||
index e1c3bf7..73b8639 100644 | ||
--- a/Products/CMFPlone/resources/browser/scripts.pt | ||
+++ b/Products/CMFPlone/resources/browser/scripts.pt | ||
@@ -1,3 +1,4 @@ | ||
+<script type="text/javascript" tal:content="string:PORTAL_URL = '${view/base_url}';"></script> | ||
<tal:scripts repeat="script view/scripts" | ||
><tal:block define="condcomment script/conditionalcomment" | ||
><tal:wcondcomment tal:condition="condcomment"> | ||
diff --git a/Products/CMFPlone/resources/browser/scripts.py b/Products/CMFPlone/resources/browser/scripts.py | ||
index 0a8d60a..52ab2cb 100644 | ||
--- a/Products/CMFPlone/resources/browser/scripts.py | ||
+++ b/Products/CMFPlone/resources/browser/scripts.py | ||
@@ -3,6 +3,7 @@ | ||
|
||
from Products.CMFPlone.resources.browser.cook import cookWhenChangingSettings | ||
from Products.CMFPlone.resources.browser.resource import ResourceView | ||
+from zope.component import getMultiAdapter | ||
|
||
@@ -6,6 +6,12 @@ CHANGES | ||
|
||
class ScriptsView(ResourceView): | ||
@@ -107,6 +108,12 @@ def default_resources(self): | ||
}) | ||
return result | ||
Fixes: | ||
|
||
+ def base_url(self): | ||
+ portal_state = getMultiAdapter((self.context, self.request), | ||
+ name=u'plone_portal_state') | ||
+ site_url = portal_state.portal_url() | ||
+ return site_url | ||
+- Fixed KeyError email on personal preferences form. This could | ||
+ happen when email is used as login name. Fixes | ||
+ https://github.com/plone/plone.app.users/issues/56 and | ||
+ https://github.com/plone/Products.CMFPlone/issues/1146 | ||
+ [maurits] | ||
+ | ||
def scripts(self): | ||
"""The requirejs scripts, the ones that are not resources are loaded on | ||
configjs.py | ||
- Ensured partial searching utility for users in 'Search for users' page | ||
Fixes https://github.com/plone/Products.CMFPlone/issues/1499 | ||
[kkhan] | ||
diff --git a/plone/app/users/browser/account.py b/plone/app/users/browser/account.py | ||
index 411e335..bd8027a 100644 | ||
--- a/plone/app/users/browser/account.py | ||
+++ b/plone/app/users/browser/account.py | ||
@@ -206,8 +206,10 @@ def handleSave(self, action): | ||
CheckAuthenticator(self.request) | ||
data, errors = self.extractData() | ||
|
||
- # extra validation for email | ||
- self.validate_email(action, data) | ||
+ # Extra validation for email, when it is there. email is not in the | ||
+ # data when you are at the personal-preferences page. | ||
+ if 'email' in data: | ||
+ self.validate_email(action, data) | ||
|
||
if action.form.widgets.errors: | ||
self.status = self.formErrorsMessage | ||
|
||
|